Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to launch firefox browser in Android device using appium. #17

Open
Skandha-commits opened this issue May 19, 2021 · 6 comments
Open

Comments

@Skandha-commits
Copy link

Skandha-commits commented May 19, 2021

Hi,

I'm unable to launch the firefox browser in an Android real device using appium.
Can someone help me in setting the capabilities and please help in fixing them.

Below capabilities were set:
capabilities = DesiredCapabilities.android();
capabilities.setCapability("deviceType", "androiddevice");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "androiddevice");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "firefox"); //Chrome
capabilities.setCapability(AndroidMobileCapabilityType.DEVICE_READY_TIMEOUT, 400);
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 180);
capabilities.setCapability(MobileCapabilityType.NO_RESET, "True");
capabilities.setCapability(MobileCapabilityType.FULL_RESET,"False");
capabilities.setCapability("automationName", "gecko");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("udid", deviceId);
capabilities.setCapability("deviceUDID",deviceId);
capabilities.setCapability("deviceName", deviceName);
FirefoxOptions firefoxOptions = new FirefoxOptions();
capabilities.setAcceptInsecureCerts(true);
capabilities.setCapability("androidPackage", "org.mozilla.firefox");
// capabilities.setCapability("browser.download.dir",System.setProperty("webdriver.gecko.driver", "C:\Users\user\Documents\peakhealth-auto\Drivers\geckodriver.exe"));
capabilities.setCapability("webdriver.gecko.driver", System.getProperty("user.dir") + File.separator + "Drivers");
firefoxOptions.addCapabilities(capabilities);

Below is the error:

An unknown server-side error occurred while processing the command. Original error: geckodriver.exe binary cannot be found in PATH. Please make sure it is present on your system (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.88 seconds
Build info: version: '3.5.2', revision: '10229a9', time: '2017-08-21T17:29:55.15Z'
System info: host: 'XXX', ip: '192.168.1.36', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '15.0.2'
Driver info: driver.version: RemoteWebDriver
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:646)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:255)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:237)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:138)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:175)
at com.mobile.base.DriverScript.isRunnableMobileWeb(DriverScript.java:514)
at testscripts.Flow_HealthFirst_USI.flow_TC001(Flow_HealthFirst_USI.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:824)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:794)
at org.testng.TestRunner.run(TestRunner.java:596)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332)
at org.testng.SuiteRunner.run(SuiteRunner.java:276)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
at org.testng.TestNG.runSuites(TestNG.java:1063)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

@mykola-mokhnach
@dpgraham

@mykola-mokhnach
Copy link
Contributor

What exactly is unclear in this error message?

@Skandha-commits
Copy link
Author

What exactly is unclear in this error message?

@mykola-mokhnach :

Error is highlighted in bold

http://127.0.0.1:4723/wd/hub ======= real device
Capabilities [{deviceType=androiddevice, noReset=True, moz:firefoxOptions={"androidPackage":"org.mozilla.firefox","deviceName":"Samsung","deviceUDID":"RZ5R419DE7J"}, version=, deviceName=androiddevice, deviceReadyTimeout=400, fullReset=False, platform=ANDROID, newCommandTimeout=180, acceptInsecureCerts=true, automationName=Gecko, browserName=firefox, platformName=Android, udid=RZ5R419DE7J}]

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: geckodriver.exe binary cannot be found in PATH. Please make sure it is present on your system (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3.45 seconds
Build info: version: '3.5.2', revision: '10229a9', time: '2017-08-21T17:29:55.15Z'
System info: host: 'XXXXXX', ip: '192.168.55.104', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '15.0.2'
Driver info: driver.version: RemoteWebDriver
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:646)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:255)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:237)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:138)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:175)
at com.mobile.base.DriverScript.isRunnableMobileWeb(DriverScript.java:521)
at testscripts.Flow_HealthFirst_USI.flow_TC001(Flow_HealthFirst_USI.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:824)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:794)
at org.testng.TestRunner.run(TestRunner.java:596)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332)
at org.testng.SuiteRunner.run(SuiteRunner.java:276)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
at org.testng.TestNG.runSuites(TestNG.java:1063)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

Below is my code:

if(Util.ucase(mobileOSPlatform).equals("ANDROID")){
capabilities = DesiredCapabilities.android();
capabilities.setCapability("deviceType", "androiddevice");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "androiddevice");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "firefox"); //Chrome
capabilities.setCapability(AndroidMobileCapabilityType.DEVICE_READY_TIMEOUT, 400);
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 180);
capabilities.setCapability(MobileCapabilityType.NO_RESET, "True");
capabilities.setCapability(MobileCapabilityType.FULL_RESET,"False");
capabilities.setCapability("automationName", "Gecko");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("udid", deviceId);
JSONObject firefoxoptions=new JSONObject();
firefoxoptions.put("androidPackage", "org.mozilla.firefox");
firefoxoptions.put("deviceUDID",deviceId);
firefoxoptions.put("deviceName", deviceName);
capabilities.setCapability("moz:firefoxOptions",firefoxoptions);
capabilities.setAcceptInsecureCerts(true);
}
System.out.println(capabilities);
if(Util.ucase(mobileOSPlatform).equals("ANDROID")){
mobileDriver = new RemoteWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
mobileDriver.manage().timeouts().implicitlyWait(implicitWait, TimeUnit.SECONDS);
}

What exactly is unclear in this error message?

@mykola-mokhnach
Copy link
Contributor

mykola-mokhnach commented May 19, 2021

You could try to apply the troubleshooting guide at https://github.com/appium/java-client/blob/master/docs/environment.md to make sure the Appium process contains the correct PATH value

@Skandha-commits
Copy link
Author

Skandha-commits commented May 19, 2021

You could try to apply the troubleshooting guide at https://github.com/appium/java-client/blob/master/docs/environment.md to make sure the Appium process contains the correct PATH value

@mykola-mokhnach
I have already set the path for gecko driver. My geckodriver.exe file is present in Drivers folder.
But still facing the same issue. Please find attached a screenshot.
gecko path

@mykola-mokhnach
Copy link
Contributor

This might not be enough. Make sure this list is actually picked up by the Appium process like it is described in that tutorial

@stefanhuber
Copy link

On Windows you have to restart the terminal after setting the PATH variable...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants