qaf icon indicating copy to clipboard operation
qaf copied to clipboard

Local driver creation attempt if remote driver is not created

Open aplatonovgd opened this issue 5 years ago • 3 comments

Hello,

We are having issues with remote driver. If, by some reason, we cannot connect to remote driver, local driver is being created automatically.

After QAF source code analysis I found this: https://github.com/qmetry/qaf/blob/b15a00381203cfe1b61d11bdb78ad66f3337897e/src/com/qmetry/qaf/automation/ui/UiDriverFactory.java#L248

Constructor<? extends WebDriver> constructor = of.getConstructor(Capabilities.class);
return constructor.newInstance(capabilities);

I already fixed it for myself by changing to:

Constructor<? extends WebDriver> constructor = of.getConstructor(URL.class, Capabilities.class);
return constructor.newInstance(new URL(urlStr), capabilities);

Just wanted to clarify whether it was designed like that or it's a typo?

aplatonovgd avatar Aug 30 '19 18:08 aplatonovgd

it's by design. Did you faced any issue because of that or just posted as question?

cjayswal avatar Aug 30 '19 21:08 cjayswal

Hi Chirag,

We have an issue that we have added a workaround for and I just wanted to clarify whether it was designed like that.

The issue is that if we work with remote server (remote.server) and if by some reason remote server is unavailable, QAF tries to create a local Appium server(which in our case we do not need). After source code analysis I found and absolutely sure that this line (please find my comment above) of code is responsible for that.

My question is: Was it designed like that? And if so, is there a way not to create a local driver if it fails to connect to remote?

You can close this issue if it was designed that way.

aplatonovgd avatar Sep 02 '19 07:09 aplatonovgd

Yes, in case of appium/mobile if you have local appium server running by design it should connect to appium server on 127.0.0.1 if it is running. So if you don't want to run on local Appium make sure that you don't have local appium server running.

If you are using remote driver (by specifying remote in driver name) that should not connect to local server if remote server connection failure.

I am keeping this issue open to get opinion from different users so that the default behavior can be changed, if required, depending on users requirement.

cjayswal avatar Nov 27 '19 01:11 cjayswal