ShaftHQ / SHAFT_ENGINE

SHAFT is a unified test automation engine for web, mobile, API, CLI, database, and desktop e2e testing. Powered by best-in-class frameworks, SHAFT provides a wizard-like syntax to drive your automation efficiently, maximize your ROI, and minimize your learning curve with no limitations! Stop reinventing the wheel! Upgrade now!
https://shafthq.github.io/
MIT License
330 stars 127 forks source link

[Bug]: Cannot instantiate webdriver from versions 8.2.20240624 or up when running Mobile tests #1760

Closed andinica-salt closed 2 weeks ago

andinica-salt commented 2 weeks ago

Describe the bug

We currently use the 8.2.20240523 SHAFT engine version. I tried upgrading to the latest one, 8.3.20240829, but I get the following error when trying to run Mobile tests: java.lang.AssertionError: Driver Factory Action "setRemoteDriverInstance" failed. With the following test data "Failed to instantiate remote driver instance.". Root cause: "java.lang.NumberFormatException: Error at index 4 in: "4723wd"" I tried other versions too, and the first one that has this problem for us is 8.2.20240624. I suppose there's been some updates regarding the capabilities / properties and how they are used. We usually get this error when there's a problem with the driver capabilities (bad platform, bad id, etc..). The difference here is that we do not see anything in the appium logs, meaning that there's no actual connection to the appium driver. The same properties/capabilities that work and instantiate the driver on 8.2.20240523 do not work further on.

Link to SHAFT_Engine Console logs

GIST of engine logs

Environment

  1. SHAFT_Engine version that exhibits the issue (Note: We support only the latest release): 8.2.20240624 or up, tried latest too -> 8.3.20240829
  2. Last SHAFT_Engine version that did not exhibit the issue (if applicable): 8.2.20240523
  3. Desktop OS: MacOS 14.5
  4. Desktop Browser (if applicable): -
  5. Desktop Browser Version (if applicable): -
  6. Mobile Device Name (if applicable): any phones, both Android and iOS
  7. Mobile Device OS (if applicable): any OS
  8. Mobile Device Browser or Native App: Native App
  9. Mobile Device Browser (if applicable): -
  10. Mobile Device Browser Version (if applicable): -

To Reproduce

Steps to reproduce the behavior:

  1. Use the capabilities found in the logs
  2. Start mobile tests

Expected behavior

Driver is instantiated and tests are run.

MohabMohie commented 2 weeks ago

Hello dear, this is a clear case of incorrect configuration.

please follow this link in the user guide: https://shafthq.github.io/docs/Properties/PropertiesList#platform

it's stated that you should configure the target execution address as follows: local, dockerized, browserstack, host:port, http://host:port/wd/hub

in your case you're using http://127.0.0.1:4723 as per the logs you shared. the engine is trying to compensate for missing wd/hub and append it to the incorrect url you provided. hence the malformed url exception showing us that the engine is attempting to connect to 4723wd which is not a valid port.

bottomline is, from your side, kindly either use the host:port approach like so: executionAddress=127.0.0.1:4723

or use the http://host:port/wd/hub approach like so: executionAddress=http://127.0.0.1:4723/wd/hub

from our side, we should enhance the error message to let you know that you passed an unacceptable parameter.

andinica-salt commented 2 weeks ago

@MohabMohie here's a GIST of the ExecutionPlatform.properties file. I understand what you're saying, but the error provided by me appears every time the instantiation fails, not only when the URL is malformed. So yeah, the thrown error should be more specific, but this is not the issue here.

MohabMohie commented 2 weeks ago

I saw the url from the logs dear, and I reexamined it from the attached file. As mentioned in my comment, the URL is provided incorrectly. Kindly use one of the two options I included in my message.