0
 private File f = new File("src/test/resources/text.txt");
 final String projectUrl = "http://someurl.com"


 @BeforeTest
 public void setUp() {
 Configuration.remote = "http://some.ip.address.129:4444/hub"
 }

 @Test
 public void smallOrderTest() throws FileNotFoundException {
   try {
       s = new Scanner(new BufferedReader(new FileReader(f.getAbsolutePath())));
       while (s.hasNext()) {
         open(projectUrl+s.next())
         }
       } finally {
           if (s != null) {
               s.close();
           }
         }
 }

What's my question. When I remove configuration string, I receive nice test on my local environment. But whet that string is here, test doesn't runs ever, and prints this:

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map

Need full stack trace?

Question is - what I'm doing wrong? How to solve this? I need to run remote tests, check links string by string from the file, and not on my local environment.

Local OS Linux Mint 17, Selenide 3.4, Selenium 2.53.0, run from Idea, Remote VM Win7, with Selenium standalone server hub and one node. Driver standard Firefox.

Fails at "open" command, if I set remote server in Configuration.

java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map

at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:251) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:131) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:158) at com.codeborne.selenide.webdriver.WebDriverFactory.createRemoteDriver(WebDriverFactory.java:61) at com.codeborne.selenide.webdriver.WebDriverFactory.createWebDriver(WebDriverFactory.java:36) at com.codeborne.selenide.impl.WebDriverThreadLocalContainer.createDriver(WebDriverThreadLocalContainer.java:213) at com.codeborne.selenide.impl.WebDriverThreadLocalContainer.getAndCheckWebDriver(WebDriverThreadLocalContainer.java:113) at com.codeborne.selenide.WebDriverRunner.getAndCheckWebDriver(WebDriverRunner.java:118) at com.codeborne.selenide.impl.Navigator.navigateToAbsoluteUrl(Navigator.java:44) at com.codeborne.selenide.impl.Navigator.open(Navigator.java:23) at com.codeborne.selenide.Selenide.open(Selenide.java:51) at SmallOrder.smallOrderTest(SmallOrder.java:44) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86) at org.testng.internal.Invoker.invokeMethod(Invoker.java:643) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112) at org.testng.TestRunner.privateRun(TestRunner.java:782) at org.testng.TestRunner.run(TestRunner.java:632) at org.testng.SuiteRunner.runTest(SuiteRunner.java:366) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) at org.testng.SuiteRunner.run(SuiteRunner.java:268) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244) at org.testng.TestNG.runSuitesLocally(TestNG.java:1169) at org.testng.TestNG.run(TestNG.java:1064) at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:74) at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:121) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

Boris
  • 125
  • 1
  • 1
  • 11

1 Answers1

0

Initializing RemoteWebDriver requires setting DesiredCapabilities (as can be seen in WebDriver's source code).

I am not a Selenide user, but it seems with version 3.4 this is a bit painful, so you can try upgrading to the latest version and use Configuration.browserCapabilities

Or, if you have no such option, see an example here: https://github.com/codeborne/selenide/issues/444

Community
  • 1
  • 1
Aneta
  • 119
  • 9