Issues configuring a linux browser on remoteseleniumwebdriver on headless machine - selenium

So,
I am trying to connect a remote selenium webdriver (3.14.0 on both ends)from my machine to the server where the code will be deployed at so that testing is always done with the production version. I know I can just access the deployed version locally but I would like to avoid that workaround.
I have x11 setup properly and I can launch google chrome from console on that machine getting the gnome version of google chrome on my local machine.
When I access the grid console with the default configuration I can see the server supports windows 10 chrome.
I have setup the hub and the node using this guide and they connect to each other properly https://www.guru99.com/introduction-to-selenium-grid.html.
My issue is that even the basic code on said tutorial requesting windows 10 chrome is giving me an error as it is not opening up on the machine(server is linux and should try to open the gnome version of chrome which I can run through x11).
package google;
import java.awt.AWTException;
import java.awt.Robot;
import java.io.IOException;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Keys;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import java.net.MalformedURLException;
import java.net.URL;
public class PruebasGoogleRemoto {
static WebDriver driver;
static String baseurl, nodeURL;
public static void main(String[] args) throws InterruptedException, AWTException, MalformedURLException {
baseurl= "http://newtours.demoaut.com/";
nodeURL="http://172.18.0.90:4420/wd/hub";
DesiredCapabilities capability= DesiredCapabilities.chrome();
capability.setBrowserName("chrome");
capability.setPlatform(Platform.WIN10);
driver=new RemoteWebDriver(new URL(nodeURL), capability);
driver.get(baseurl);
}
}
The error log I am getting is the following:
Exception in thread "main" org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities {browserName: chrome, platform: UNIX, version: }
Command duration or timeout: 138 milliseconds
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
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$0(ProtocolHandshake.java:122)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:125)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:143)
at google.PruebasGoogleRemoto.main(PruebasGoogleRemoto.java:36)
Caused by: org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : Capabilities {browserName: chrome, platform: UNIX, version: }
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:05:20.749Z'
System info: host: 'PC-10589', ip: '192.168.56.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: unknown
at org.openqa.grid.web.servlet.handler.RequestHandler.process(RequestHandler.java:118)
at org.openqa.grid.web.servlet.DriverServlet.process(DriverServlet.java:85)
at org.openqa.grid.web.servlet.DriverServlet.doPost(DriverServlet.java:69)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:860)
at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.seleniumhq.jetty9.server.Server.handle(Server.java:530)
at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:347)
at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:256)
at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:102)
at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.seleniumhq.jetty9.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
at java.lang.Thread.run(Thread.java:748)
I have gone ahead on the tutorial and attempted to use the default hub configuration found at https://github.com/SeleniumHQ/selenium/blob/master/java/server/src/org/openqa/grid/common/defaults/DefaultHub.json when launching the hub and then use a defaultnode.json file launching the node.
{
"capabilities":
[
{
"browserName": "firefox",
"maxInstances": 5,
"seleniumProtocol": "WebDriver"
},
{
"browserName": "chrome",
"maxInstances": 5,
"seleniumProtocol": "WebDriver",
"platformName" : "LINUX"
},
{
"browserName": "internet explorer",
"maxInstances": 1,
"seleniumProtocol": "WebDriver"
}
],
"proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
"maxSession": 5,
"port": 5555,
"register": true,
"registerCycle": 5000,
"hub": "http://172.18.0.90:4420",
"nodeStatusCheckTimeout": 5000,
"nodePolling": 5000,
"role": "node",
"unregisterIfStillDownAfter": 60000,
"downPollingLimit": 2,
"debug": false,
"servlets" : [],
"withoutServlets": [],
"custom": {}
}
After doing this I obtain the following list of available browsers on the grid console.grid console ignoring the linux browser
I am now wondering how to add support for a linux browser on my node as I know for a fact I can launch the gnome version of chrome on a windows machine that is connected to this headless machine through terminal using x11.

Related

InvalidArgumentException: invalid argument: Unsupported locator strategy: -custom error with Appium using Selenium ChromeDriver and Chrome

I'm trying to run the test.ai plugin for appium (https://github.com/testdotai/appium-classifier-plugin). It has a custom locator strategy. I set up appium (version 1.13.0, also tried downgrading to 1.9.2-beta.2) and did:
'npm install -g test-ai-classifier'
it was installed, as shown:
https://i.stack.imgur.com/fwtkt.png
I then wrote a simple test to check if everything is set up correctly:
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.MobileBy;
import io.appium.java_client.MobileElement;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
public class TestClass {
private AppiumDriver driver;
private By cart = MobileBy.custom("cart");
#Before
public void setUp() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "9");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "NB1GAD17B1504154");
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "Chrome");
HashMap<String, String> customFindModules = new HashMap<>();
customFindModules.put("ai", "test-ai-classifier");
capabilities.setCapability("customFindModules", customFindModules);
capabilities.setCapability("shouldUseCompactResponses", false);
driver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"), capabilities);
}
#After
public void tearDown(){
}
#Test
public void testMethod(){
goToWebsite(driver);
openCartUseAi(driver);
}
public void goToWebsite(AppiumDriver driver){
driver.get("https://www.ebay.com/");
}
public void openCartUseAi(AppiumDriver driver){
driver.findElement(cart).click();
}
}
This causes the following error when ran:
/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java -ea -Didea.test.cyclic.buffer.size=1048576 -javaagent:/home/piotrek/intellij/ideaIC-2019.1.2/idea-IC-191.7141.44/lib/idea_rt.jar=46303:/home/piotrek/intellij/ideaIC-2019.1.2/idea-IC-191.7141.44/bin -Dfile.encoding=UTF-8 -classpath /home/piotrek/intellij/ideaIC-2019.1.2/idea-IC-191.7141.44/lib/idea_rt.jar:/home/piotrek/intellij/ideaIC-2019.1.2/idea-IC-191.7141.44/plugins/junit/lib/junit-rt.jar:/home/piotrek/intellij/ideaIC-2019.1.2/idea-IC-191.7141.44/plugins/junit/lib/junit5-rt.jar:/home/piotrek/IdeaProjects/appiumTestMVN/target/test-classes:/home/piotrek/Downloads/selenium-server-standalone-3.141.59.jar:/home/piotrek/.m2/repository/io/appium/java-client/7.0.0/java-client-7.0.0.jar:/home/piotrek/.m2/repository/org/seleniumhq/selenium/selenium-java/3.141.59/selenium-java-3.141.59.jar:/home/piotrek/.m2/repository/org/seleniumhq/selenium/selenium-chrome-driver/3.141.59/selenium-chrome-driver-3.141.59.jar:/home/piotrek/.m2/repository/org/seleniumhq/selenium/selenium-edge-driver/3.141.59/selenium-edge-driver-3.141.59.jar:/home/piotrek/.m2/repository/org/seleniumhq/selenium/selenium-firefox-driver/3.141.59/selenium-firefox-driver-3.141.59.jar:/home/piotrek/.m2/repository/org/seleniumhq/selenium/selenium-ie-driver/3.141.59/selenium-ie-driver-3.141.59.jar:/home/piotrek/.m2/repository/org/seleniumhq/selenium/selenium-opera-driver/3.141.59/selenium-opera-driver-3.141.59.jar:/home/piotrek/.m2/repository/org/seleniumhq/selenium/selenium-remote-driver/3.141.59/selenium-remote-driver-3.141.59.jar:/home/piotrek/.m2/repository/org/seleniumhq/selenium/selenium-safari-driver/3.141.59/selenium-safari-driver-3.141.59.jar:/home/piotrek/.m2/repository/net/bytebuddy/byte-buddy/1.8.15/byte-buddy-1.8.15.jar:/home/piotrek/.m2/repository/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar:/home/piotrek/.m2/repository/com/google/guava/guava/25.0-jre/guava-25.0-jre.jar:/home/piotrek/.m2/repository/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar:/home/piotrek/.m2/repository/org/checkerframework/checker-compat-qual/2.0.0/checker-compat-qual-2.0.0.jar:/home/piotrek/.m2/repository/com/google/errorprone/error_prone_annotations/2.1.3/error_prone_annotations-2.1.3.jar:/home/piotrek/.m2/repository/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar:/home/piotrek/.m2/repository/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar:/home/piotrek/.m2/repository/com/squareup/okhttp3/okhttp/3.11.0/okhttp-3.11.0.jar:/home/piotrek/.m2/repository/com/squareup/okio/okio/1.14.0/okio-1.14.0.jar:/home/piotrek/.m2/repository/org/seleniumhq/selenium/selenium-support/3.141.59/selenium-support-3.141.59.jar:/home/piotrek/.m2/repository/org/seleniumhq/selenium/selenium-api/3.141.59/selenium-api-3.141.59.jar:/home/piotrek/.m2/repository/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar:/home/piotrek/.m2/repository/org/apache/httpcomponents/httpclient/4.5.6/httpclient-4.5.6.jar:/home/piotrek/.m2/repository/org/apache/httpcomponents/httpcore/4.4.10/httpcore-4.4.10.jar:/home/piotrek/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/home/piotrek/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar:/home/piotrek/.m2/repository/cglib/cglib/3.2.8/cglib-3.2.8.jar:/home/piotrek/.m2/repository/org/ow2/asm/asm/6.2.1/asm-6.2.1.jar:/home/piotrek/.m2/repository/org/apache/ant/ant/1.10.3/ant-1.10.3.jar:/home/piotrek/.m2/repository/org/apache/ant/ant-launcher/1.10.3/ant-launcher-1.10.3.jar:/home/piotrek/.m2/repository/commons-validator/commons-validator/1.6/commons-validator-1.6.jar:/home/piotrek/.m2/repository/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar:/home/piotrek/.m2/repository/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar:/home/piotrek/.m2/repository/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar:/home/piotrek/.m2/repository/org/apache/commons/commons-lang3/3.8/commons-lang3-3.8.jar:/home/piotrek/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar:/home/piotrek/.m2/repository/org/springframework/spring-context/5.1.0.RELEASE/spring-context-5.1.0.RELEASE.jar:/home/piotrek/.m2/repository/org/springframework/spring-aop/5.1.0.RELEASE/spring-aop-5.1.0.RELEASE.jar:/home/piotrek/.m2/repository/org/springframework/spring-beans/5.1.0.RELEASE/spring-beans-5.1.0.RELEASE.jar:/home/piotrek/.m2/repository/org/springframework/spring-core/5.1.0.RELEASE/spring-core-5.1.0.RELEASE.jar:/home/piotrek/.m2/repository/org/springframework/spring-jcl/5.1.0.RELEASE/spring-jcl-5.1.0.RELEASE.jar:/home/piotrek/.m2/repository/org/springframework/spring-expression/5.1.0.RELEASE/spring-expression-5.1.0.RELEASE.jar:/home/piotrek/.m2/repository/org/aspectj/aspectjweaver/1.9.1/aspectjweaver-1.9.1.jar:/home/piotrek/.m2/repository/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar:/home/piotrek/.m2/repository/junit/junit/4.12/junit-4.12.jar:/home/piotrek/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 TestClass,testMethod
Jun 07, 2019 1:43:44 PM io.appium.java_client.remote.AppiumCommandExecutor$1 lambda$0
INFO: Detected dialect: W3C
org.openqa.selenium.InvalidArgumentException: invalid argument: Unsupported locator strategy: -custom
(Session info: chrome=74.0.3729.157)
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729#{#29}),platform=Linux 5.0.0-15-generic x86_64)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'piotrek-VirtualBox', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.0.0-15-generic', java.version: '11.0.3'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {browserName: Chrome, customFindModules: {ai: test-ai-classifier}, databaseEnabled: false, desired: {browserName: Chrome, customFindModules: {ai: test-ai-classifier}, deviceName: NB1GAD17B1504154, platformName: android, platformVersion: 9, shouldUseCompactResponses: false}, deviceManufacturer: HMD Global, deviceModel: TA-1004, deviceName: NB1GAD17B1504154, deviceScreenSize: 1440x2560, deviceUDID: NB1GAD17B1504154, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, platform: LINUX, platformName: Android, platformVersion: 9, shouldUseCompactResponses: false, takesScreenshot: true, warnings: {}, webStorageEnabled: false}
Session ID: 6cb83c3b-3405-483a-8dc3-21eec62b4676
*** Element info: {Using=-custom, value=ai:cart}
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:323)
at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
at io.appium.java_client.android.AndroidDriver.findElement(AndroidDriver.java:1)
at io.appium.java_client.FindsByCustom.findElementByCustom(FindsByCustom.java:38)
at TestClass.openCartUseAi(TestClass.java:64)
at TestClass.testMethod(TestClass.java:49)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Process finished with exit code 255
Can anyone tell me what I'm doing wrong? When rewriting this test to not use the plugin, everything works fine, so Appium is set up correctly.
I had a look at this doc, but still can't see what I'm missing: http://appium.io/docs/en/advanced-concepts/element-finding-plugins/
Thank You in advance for your help!
PS not sure if this is relevant, but I'm using an Ubuntu virtual machine for this
This error message...
org.openqa.selenium.InvalidArgumentException: invalid argument: Unsupported locator strategy: -custom
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session due to an invalid argument within an Unsupported locator strategy.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
You are using chromedriver=2.46
Release Notes of chromedriver=2.46 clearly mentions the following :
Supports Chrome v71-73
You are using chrome=74.0
Release Notes of ChromeDriver v74.0 clearly mentions the following :
Supports Chrome v74
So there is a clear mismatch between ChromeDriver v2.46 and the Chrome Browser v74.0
Solution
Upgrade ChromeDriver to ChromeDriver v75.0 level.
Upgrade Chrome to Chrome v75 level. (as per ChromeDriver v75.0 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
Okay, got this figured out myself. Apparently Appium and Test.Ai don't yet support a custom locator strategy on web apps. This only works on native apps for now. Shame they didn't put this info in their documentation :P
Set this capability,
setCapability("chromeOptions", ImmutableMap.of("w3c", false));
On my side got the same issue, I was try out this code it worked smoothly.

Firefox browser closes without opening the specified URL

I am new to Selenium as can be seen by me specifying the absolute path while identifying elements. I have written a simple code for opening gmail login page which is
`
package SeleniumScripts;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class LogintoGmail {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", "D:\\Selenium\\geckodriver-v0.19.1-win64\\geckodriver.exe");`enter code here`
// System.setProperty("webdriver.ie.driver", "D:\\Selenium\\IEDriverServer_x64_3.8.0\\IEDriverServer.exe");
WebDriver driver=new FirefoxDriver();
// WebDriver driver=new InternetExplorerDriver();
driver.get("http://www.gmail.com/");
driver.manage().window().maximize();
driver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div/div[2]/form/div[2]/div/div/div/ul[1]/li[1]/div/div[2]/p[2]")).click();
driver.findElement(By.xpath("/html/body/div[1]/div/div[2]/div/div[2]/div/div/div[2]/div/div[1]/div/form/content/section/div/content/div[1]/div/div[1]/div/div[1]/input")).sendKeys("12!harley");
String apptitle=driver.getTitle();
System.out.println(apptitle);
}
}
`
While running the code Firefox opens & then without opening the URL closes.I am getting the below error during execution:
1541589284453 Marionette DEBUG Remote service is active
1541589284765 Marionette DEBUG Accepted connection 0 from 127.0.0.1:51510
1541589284777 Marionette TRACE 0 -> [0,1,"newSession",{"acceptInsecureCerts":true,"browserName":"firefox","capabilities":{"desiredCapabilities":{"acceptInsecureCerts":true,"browserName":"firefox"}}}]
1541589284778 Marionette TRACE 0 <- [1,1,{"error":"unknown command","message":"newSession","stacktrace":"WebDriverError#chrome://marionette/content/error.js:178: ... et#chrome://marionette/content/server.js:245:8\n_onJSONObjectReady/<#chrome://marionette/content/transport.js:490:9\n"},null]
Nov 07, 2018 4:44:45 PM org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown error' (500 expected)
Exception in thread "main" org.openqa.selenium.WebDriverException: newSession
Build info: version: '3.12.0', revision: '7c6e0b3', time: '2018-05-08T15:15:03.216Z'
System info: host: 'USER-PC', ip: '192.168.43.64', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '9.0.4'
Driver info: driver.version: FirefoxDriver
remote stacktrace: WebDriverError#chrome://marionette/content/error.js:178:5
UnknownCommandError#chrome://marionette/content/error.js:472:5
despatch#chrome://marionette/content/server.js:290:13
execute#chrome://marionette/content/server.js:271:11
onPacket/<#chrome://marionette/content/server.js:246:15
onPacket#chrome://marionette/content/server.js:245:8
_onJSONObjectReady/<#chrome://marionette/content/transport.js:490:9
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$new$0(W3CHandshakeResponse.java:57)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$getResponseFunction$2(W3CHandshakeResponse.java:104)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.base/java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.base/java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:543)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:207)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:103)
at SeleniumScripts.LogintoGmail.main(LogintoGmail.java:12)
Please note this was running fine one week back but now i am getting error.
package SeleniumScripts;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class LogintoGmail {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", "D:\\Selenium\\geckodriver-v0.19.1-win64\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.gmail.com/");
driver.manage().window().maximize();
driver.findElement(By.xpath("X/PATH")).click();
driver.findElement(By.xpath("X/PATH")).sendKeys("12!harley");
String apptitle = driver.getTitle();
System.out.println(apptitle);
Try copying what i've done, the code although extremely messy was correct just you didn't have spaces when you were declaring your firefox driver, there were two instances where you didn't have proper spacing and it does make a difference.
When the code is wrong, a lot of the time the driver will force the browser open but will leave the URL empty or a null value and not continue the test.
If i was you, i would start with just opening the page and build on top of the script.

FAILED CONFIGURATION: #BeforeClass beforeClass - Unable to create new remote session

I am a beginner to Selenium and TestNG. I am successfully running my scripts in IE but they are not executing in FireFox. I am using FireFox version 54.0.1 (32-bit), Selenium-java-3.3.1 - Geckodriver-v0.17.0-win32. Below is my code -
package HealthiIndividualScripts;
import org.testng.annotations.Test;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import HealthiScreens.DashboardPage;
import HealthiScreens.LogOnPage;
import HealthiScreens.PatientFilterPage;
import HealthiScreens.PersonFormPage;
import HealthiScreens.RolePage;
import HealthiScreens.ToolsPage;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
public class FFTestCaseTwo {
private WebDriver driver;
private String baseUrl;
private static final Logger log = LogManager.getLogger(FFTestCaseTwo.class.getName());
#BeforeClass
public void beforeClass() {
System.setProperty("webdriver.gecko.driver","U:\\My Documents\\Selenium\\Gecko\\geckodriver.exe");
driver = new FirefoxDriver();
baseUrl = "https://test.com/login";
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get(baseUrl);
}
#Test
public void FFPharmacistCreatePatient() {
LogOnPage.fillUserTextBox(driver, "*******");
LogOnPage.fillPasswordTextBox(driver, "********");
LogOnPage.clickOnSignInButton(driver);
RolePage.RoleElement(driver);
RolePage.clickOnRoleElement(driver);
DashboardPage.ClinicalRecordElement(driver);
DashboardPage.clickOnClinicalRecordElement(driver);
PatientFilterPage.clickOnNewPatientButton(driver);
PersonFormPage.CompleteTitleField(driver, "Mr.");
PersonFormPage.fillFirstNameTextBox(driver, "Testautofirstname");
PersonFormPage.fillMiddleNameTextBox(driver, "Middletest");
PersonFormPage.fillLastNameTextBox(driver, "Testautolastname");
PersonFormPage.fillDateofBirthBox(driver, "14/01/1980");
PersonFormPage.fillNHSNumberTextBox(driver, "1111111111");
PersonFormPage.CompleteEthnicityField(driver, "White");
ToolsPage.WaitForXSeconds(3);
PersonFormPage.fillTelephoneBox(driver, "01255888888");
PersonFormPage.CompleteSubgroupField(driver, "Other White background");
PersonFormPage.clickConsentTabElement(driver);
PersonFormPage.clickYesRadioButton(driver);
PersonFormPage.clickOnOKButton(driver);
ToolsPage.WaitForXSeconds(3);
PersonFormPage.clickOnDuplicatePatientYesButton(driver);
ToolsPage.WaitForXSeconds(3);
log.info("Test run successfully");
}
#AfterClass
public void afterMethod() {
driver.switchTo().defaultContent();
driver.findElement(By.xpath(".//*[#class='ui-menuitem-icon ui-icon log-out']")).click();
driver.close();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
And I am getting the following error -
FAILED CONFIGURATION: #BeforeClass beforeClass
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}}], required capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}}]
Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800'
System info: host: 'LPTE-CGF68Z1', ip: '10.3.8.28', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_51'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:121)
at HealthiIndividualScripts.FFTestCaseTwo.beforeClass(FFTestCaseTwo.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:166)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
SKIPPED CONFIGURATION: #AfterClass afterMethod
SKIPPED: FFPharmacistCreatePatient
org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}}], required capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}}]
Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800'
System info: host: 'LPTE-CGF68Z1', ip: '10.3.8.28', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_51'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:125)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:121)
at HealthiIndividualScripts.FFTestCaseTwo.beforeClass(FFTestCaseTwo.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:166)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
at org.testng.TestRunner.privateRun(TestRunner.java:744)
at org.testng.TestRunner.run(TestRunner.java:602)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
Your code looks correct.
I suppose that problem lies in a version of your FireFox and Geckodriver. Check what version of Geckodriver support your FireFox version and update version of selenium to the last one.
Hope this help you too.

Selenium Grid cannot able create a new session error is showing

I am learning Selenium Grid and beginner for it.I setup my hub by using command:-
java -jar selenium-server-standalone-3.3.0.jar -role hub
and node is setup by using command:- java -jar selenium-server-standalone-3.3.0.jar -role webdriver -hub IP_of_hub:4444/grid/register -port 1234
Than i created a java project and created a class and write the down the code
import junit.framework.Assert;
import java.net.MalformedURLException;
import java.net.URL;
import org.apache.xerces.util.URI.MalformedURIException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
public class selGrid {
WebDriver driver;
String base_url,node_url;
#BeforeTest
public void setUp() throws MalformedURLException{
System.setProperty("webdriver.gecko.driver","C://Users//Administrator//Downloads//geckodriver.exe");
base_url="http://newtours.demoaut.com";
node_url="http://localhost:1234/wd/hub";
DesiredCapabilities capability=DesiredCapabilities.firefox();
capability.setBrowserName("firefox");
capability.setPlatform(Platform.WINDOWS);
driver=new RemoteWebDriver(new URL(node_url),capability);
}
#AfterTest
public void afterTest()
{
driver.quit();
}
public void simpleTest()
{
driver.get(base_url);
Assert.assertEquals("Welcome", driver.getTitle());
}
}}
And run it is as TestNGand in the console below text is showing
FAILED CONFIGURATION: #BeforeTest setUp org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=firefox, moz:firefoxOptions= {binary=Optional[FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe)], args=[], legacy=null, logLevel=null, prefs={}, profile=null}, version=, platform=WINDOWS}], required capabilities = Capabilities [{}]
Build info: version: '3.3.0', revision: 'b526bd5', time: '2017-03-07 11:21:31 -0800'
System info: host: 'UNO-13-PC', ip: '192.168.0.4', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
Command duration or timeout: 0 milliseconds
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:363)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:113)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:158)
at selGrid.setUp(selGrid.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:523)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:224)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:146)
at org.testng.TestRunner.beforeRun(TestRunner.java:626)
at org.testng.TestRunner.run(TestRunner.java:594)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=firefox, moz:firefoxOptions= {binary=Optional[FirefoxBinary(C:\Program Files (x86)\Mozilla Firefox\firefox.exe)], args=[], legacy=null, logLevel=null, prefs={}, profile=null}, version=, platform=WINDOWS}], required capabilities = Capabilities [{}]
Build info: version: '3.3.0', revision: 'b526bd5', time: '2017-03-07 11:21:31 -0800'
System info: host: 'UNO-13-PC', ip: '192.168.0.4', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
Build info: version: '3.3.0', revision: 'b526bd5', time: '2017-03-07 11:21:31 -0800'
System info: host: 'UNO-13-PC', ip: '192.168.0.4', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:243)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:121)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:164)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.server.FirefoxDriverProvider.callConstructor(FirefoxDriverProvider.java:81)
at org.openqa.selenium.remote.server.FirefoxDriverProvider.newInstance(FirefoxDriverProvider.java:63)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:60)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:222)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:209)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
SKIPPED CONFIGURATION: #AfterTest afterTest
===============================================
Default test
Tests run: 0, Failures: 0, Skips: 0
Configuration Failures: 1, Skips: 1
===============================================
===============================================
Default suite
Total tests run: 0, Failures: 0, Skips: 0
Configuration Failures: 1, Skips: 1
===============================================
Set the path of geckodriver and use the latest version of firefox(or one can check compatible firefox for standalone server).
Now I used firefox ver 52.0.2 and standalone server is 3.3.0

Selenium Webdriver - findElement atom issue

SELENIUM WEBDRIVER - IE
I'm trying to click on a link by using the following command:
driver.findElement(By.linkText("Previous orders")).click();
and I'm getting this error ... I could make it work some times but most of the time I get this error, it's intermitent, any ideas?
> Started InternetExplorerDriver server (32-bit)
2.50.0.0
Listening on port 25630
Only local connections are allowed
Exception in thread "main" org.openqa.selenium.WebDriverException: A JavaScript error was encountered executing the findElement atom. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 46 milliseconds
Build info: version: '2.50.1', revision: 'd7fc91b', time: '2016-01-29 19:04:49'
System info: host: 'ABC598-L1BCDL9', ip: 'xxx.xxx.xxx.xxx', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_71'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:25630/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 9865fcae-fa06-46b5-a621-d8390978c515
*** Element info: {Using=link text, value=Previous orders}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByLinkText(RemoteWebDriver.java:428)
at org.openqa.selenium.By$ByLinkText.findElement(By.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
at Test.main(Test.java:27)
Main Code:
import java.util.concurrent.TimeUnit;
import javax.swing.JOptionPane;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.security.UserAndPassword;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
public class Test {
public static void main(String[] args) throws InterruptedException {
String cartId = JOptionPane.showInputDialog("Type the Cart ID:");
System.setProperty("webdriver.ie.driver",
"C:\\Users\\USER_ADMIN\\Downloads\\Selenium Webdriver\\IEDriverServer.exe");
DesiredCapabilities returnCapabilities = DesiredCapabilities.internetExplorer();
returnCapabilities.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, false);
WebDriver driver = new InternetExplorerDriver(returnCapabilities);
driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
driver.get("https://k06proxy012.sby.com/procurement/buyondemand/common/enUS/index.html");
driver.findElement(By.linkText("Log in to Buy on demand (Bond)")).click();
login(driver);
// START
driver.findElement(By.linkText("Previous orders")).click();
driver.findElement(By.linkText("Search previous orders")).click();
new Select(driver.findElement(By.id("FIELD1"))).selectByVisibleText("Cart ID");
driver.findElement(By.id("VALUE1")).clear();
driver.findElement(By.id("VALUE1")).sendKeys(cartId);
driver.quit();
}
public static void login(WebDriver driver) {
WebDriverWait wait = new WebDriverWait(driver, 10);
Alert alert = wait.until(ExpectedConditions.alertIsPresent());
alert.authenticateUsing(new UserAndPassword("user", "pass"));
}
}
Try to turn protected mode on IE
Click/tap on tools on the menu bar, and Internet Options
In the Security tab, select every zone and turn off protected mode
else can you write the main's code
I don't think the error is caused by erroneous code on your part. I tried upgrading to IEDriverServer 2.50 today and started receiving the same error. I returned to using 2.48 as a temporary workaround. Other newer versions may work between the two, this is just what I used previously.
Also see this recent issue on the project's Github page: https://github.com/SeleniumHQ/selenium/issues/1590
It seems that i found the reproducable case.
Check this issue https://github.com/SeleniumHQ/selenium/issues/2421
The point is in this javascript instruction:
var Number="рпоп";
Note, that if you write "number" (first small letter) - it will be working.
It seems the problem is in incorrect javascript code parsing.