Please help to resolve the below issue.
I am using the Eclipse.My main class call the 2 below class/java file.
1) Invoke_SoapUI_Project.java ( this executes the SOAP UI project )
2) Run_Selenium_Script.java ( This opens one of the URL from Firefox ).
My main function call the above Invoke_SoapUI_Project.java and triggers the execution of "SOAP UI XML Project" and it runs well.
Then my second function "Run_Selenium_Script.java" calls and it tries to open the one of Webpage. but getting the below error at the line where i am defining webdriver object. i.e driver= new firefoxDriver();
But if i comment the Invoke_SoapUI_Project.java, then i won't get below exceptions, the firefox object creates properly and it opens the my URL.
The below exception i am getting:
org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.44.0', revision: '76d78cf323ce037c5f92db6c1bba601c2ac43ad8', time: '2014-10-23 13:11:40'
System info: host: 'BDC8-L-HP26ZR1', ip: '127.0.0.1', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_31'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:191)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:99)
at Services.CommonFunctions.setUp(CommonFunctions.java:1481)
at Services.CommonFunctions.obj_run(CommonFunctions.java:1631)
at Services.CSS_Validation_a.print(CSS_Validation_a.java:283)
at Services.CSS_main.main(CSS_main.java:67)
Caused by: java.lang.NullPointerException
at org.apache.http.impl.conn.SystemDefaultRoutePlanner.determineProxy(SystemDefaultRoutePlanner.java:79)
at org.apache.http.impl.conn.DefaultRoutePlanner.determineRoute(DefaultRoutePlanner.java:76)
at org.apache.http.impl.client.InternalHttpClient.determineRoute(InternalHttpClient.java:124)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:183)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:215)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:184)
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:165)
at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:362)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572)
... 10 more
We stumbled across what appears to be the same problem here (took us quite some time) but we managed to work around it:
The Problem seems to be that SoapUI sets the default proxyselector to null and Apache httpclient is not expecting this.
Reproducing the Problem:
WsdlProject wsdlProject = new WsdlProject("");
WebDriver driver = new FirefoxDriver();
Workaround:
ProxySelector proxy = ProxySelector.getDefault();
WsdlProject wsdlProject = new WsdlProject("");
ProxySelector.setDefault(proxy);
WebDriver driver = new FirefoxDriver();
peidong-hu sent a patch for standalone two days ago (took the solution from there):
https://github.com/Ardesco/selenium-standalone-server-plugin/issues/23
I already filed an error report for selenium, will update it with this details: https://github.com/SeleniumHQ/selenium/issues/388
I'm also going to file a report for SoapUI.
As per the link
You need to set the firefox driver and provide it as system property.
For eg:
System.setProperty("webdriver.firefox.driver", "c:/webdriver/firefoxdriverpath");
I also found this issue when using SoapUI 5. I checked the source code.
In the class ProxyUtils, the method setGlobalProxy() will set the proxySelector to null if you don't set the proxy or set the proxy to Automatic.
public static void setGlobalProxy( Settings settings )
{
ProxySelector proxySelector = null;
ProxySettingsAuthenticator authenticator = null;
if( proxyEnabled )
{
if( autoProxy )
{
proxySelector = new ProxyVoleUtil().createAutoProxySearch().getProxySelector();
}
else
{
proxySelector = getManualProxySelector( settings );
}
if( proxySelector != null )
{
// Don't register any proxies for other schemes
proxySelector = filterHttpHttpsProxy( proxySelector );
}
authenticator = new ProxySettingsAuthenticator();
}
*ProxySelector.setDefault( proxySelector );*
Authenticator.setDefault( authenticator );
HttpClientSupport.setProxySelector( proxySelector );
HttpClientSupport.getHttpClient().setCredentialsProvider( getProxyCredentials( settings ) );
}
In Windows OS, proxySelector = new ProxyVoleUtil().createAutoProxySearch().getProxySelector(); also will be null.
if (PlatformUtil.getCurrentPlattform() != PlatformUtil.Platform.WIN) {
proxySearch.addStrategy(ProxySearch.Strategy.BROWSER);
// For Windows both BROWSER and OS_DEFAULT will end up with an IEProxySearchStrategy.
// The call in createPacSelector to winHttpDetectAutoProxyConfigUrl is quite slow and we don't want to do it twice.
}
My solution is modify the ProxyUtils class. Change ProxySelector.setDefault( proxySelector ); to
if(proxySelector != null){
ProxySelector.setDefault(proxySelector);
}
else{
proxySelector = ProxySelector.getDefault();
}
Then I use my own ProxyUtils.class, update the ProxyUtils.class in soapui-xxx.jar (in SOAPUI_HOME\bin\) through WinRAR or 7Z. Now my SoapUI works very well.
Related
OS:Windows 10
Execution Environment : JavaSE-1.8 (jre1.8.0_144)
JARs and class folders on build path:
client-combined-3.6.0-sources.jar
client-combined3.6.0.jar
selenium-server-standalone-3.6.0.jar
Browser:
FireFox 56.0
Code Snippet:
System.setProperty("webdriver.firefox.marionette","C:/Users/admin/Downloads/geckodriver-v0.11.1-win32/geckodriver.exe");
WebDriver driver = new FirefoxDriver ();
driver.get("https://www.facebook.com");
Error:
Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting 45 seconds for Firefox to start.
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T16:15:26.402Z'
System info: host: 'ADMIN-PC', ip: '192.168.1.6', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_144'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.XpiDriverService.waitUntilAvailable(XpiDriverService.java:112)
at org.openqa.selenium.firefox.XpiDriverService.start(XpiDriverService.java:97)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:217)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:140)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:120)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:98)
at FacebookFriends.main(FacebookFriends.java:18)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:45149/hub/status] to be available after 45005 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
at org.openqa.selenium.firefox.XpiDriverService.waitUntilAvailable(XpiDriverService.java:110)
... 8 more
Caused by: java.util.concurrent.TimeoutException
at java.util.concurrent.FutureTask.get(Unknown Source)
at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:147)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
... 9 more
First of all You are using a little bit old version of gecko driver. The newest from: https://github.com/mozilla/geckodriver/releases
Then You need to set up system property with:
File gecko = new File("C:/Users/admin/Downloads/geckodriver-v0.19.0-win32/geckodriver.exe");
System.setProperty("webdriver.gecko.driver", gecko.getAbsolutePath());
If You really want to use marionette check answers on: Difference between webdriver.firefox.marionette & webdriver.gecko.driver
I haved this error for 2 days, the solution for me was in Set.Plataform put Platafor.ANY or Plataform.Windows because Plataform.WIN10 not worked, marionette wasn't necessary and I added and neether works, only works this. I hope this helps someone else:
public class Main {
public static RemoteWebDriver driver;
public static void main(String[] args) throws MalformedURLException {
System.setProperty("webdriver.gecko.driver", "D:/Lib/geckodriver.exe");
DesiredCapabilities desiredCapabilities = new DesiredCapabilities().firefox();
desiredCapabilities.setPlatform(Platform.ANY);
desiredCapabilities.setBrowserName("firefox");
driver = new RemoteWebDriver(new URL("http://172.20.19.182:5557/wd/hub"), desiredCapabilities);
driver.navigate().to("http://www.google.com");
driver.findElementByName("q").sendKeys("execute automation");
driver.findElementByName("q").sendKeys(Keys.ENTER);
driver.close();
// write your code here
}
}
You can also try using double \\ in the path of the geckodriver.
Also instead of using :
System.setProperty(
"webdriver.firefox.marionette",
"C:/Users/admin/Downloads/geckodriver-v0.11.1-win32/geckodriver.exe");
Can you try using
System.setProperty(
"webdriver.gecko.driver",
"C:\\Users\\admin\\Downloads\\geckodriver-v0.11.1-win32\\geckodriver.exe");
Title : Problem Resolved
Solution Accepted :
- Use latest version of gecko driver
Code Used
- System.setProperty("webdriver.gecko.driver","C:\Marionette\geckodriver_1.exe" );
In my Java project I am using Selenium for web automation. I am using chromedriver v2.20 executable. First "ChromeDriverService" is initialised and that is used to create ChromeDriver like, "new ChromeDriver(service, capabilities);". Also I used BrowserMobProxy to capture all web requests.
In my test I navigate to some URLs multiple times, after each navigation driver implicitly waits for few seconds, then polls result.
But while Execution it gives me timeout Exception.
In my research I came across solutions which are not working for me:
Instead of implicitlyWait use Thread.sleep
Replace new RemoteWebDriver(service.getUrl(), capabilities); by new ChromeDriver(service, capabilities);
After new ChromeDriver(...), wait for 1 sec using Thread.sleep(1000);
Can anyone please tell me why this error occurs ? how to handle this ?
ShouldPostToServerTest.java:
#Test
public void setTest() throws Exception {
for (int i = 0; i < 3; i++) {
nav();
poll();
}
}
private void nav() {
String[] navTo = {"http://www.bestbuy.com","http://www.amazon.com"};
for (int n = 0; n < 30 / navTo.length; n++) {
for (String url : navTo) {
chrome.navigateTo(url);
chrome.waitFor(5000);
}
}
}
private void poll() {
int pollInterval = 1000;
int remaining = 120 * 1000;
boolean found = false;
while (remaining > 0) {
if (found) // populateResult(), omitted for now.
break;
chrome.waitFor(pollInterval);
remaining -= pollInterval;
}
}
Chrome.java:
public void navigateTo(String url) {
if (driver == null)
return;
driver.navigate().to(url); // TimeOut
}
public void waitFor(long waitFor) {
long start = System.currentTimeMillis();
driver.manage().timeouts().implicitlyWait(waitFor, TimeUnit.MILLISECONDS);
long duration = System.currentTimeMillis() - start;
long remaining = waitFor - duration;
if (remaining > 0) {
try {
Thread.sleep(remaining);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}
Error stack trace:
Connected to the target VM, address: '127.0.0.1:57086', transport: 'socket'
Starting ChromeDriver 2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b) on port 13817
Only local connections are allowed.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Vector smash protection is enabled.
Vector smash protection is enabled.
[723.497][SEVERE]: Timed out receiving message from renderer: 600.000
[1323.497][SEVERE]: Timed out receiving message from renderer: 600.000
Exception:
org.openqa.selenium.WebDriverException: unknown error: cannot
determine loading status from timeout: Timed out receiving message
from renderer: 600.000 (Session info: chrome=45.0.2454.101)
(Driver info: chromedriver=2.20.353124
(035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux
3.19.0-28-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 1200.01 seconds
Build info: version: '2.48.2', revision:
'41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09
13:08:06' System info: host: 'yogesh-ubuntu', ip: '127.0.1.1',
os.name: 'Linux', os.arch: 'amd64', os.version: '3.19.0-28-generic',
java.version: '1.8.0_60' Driver info:
org.openqa.selenium.chrome.ChromeDriver Capabilities
[{applicationCacheEnabled=false, rotatable=false,
mobileEmulationEnabled=false,
chrome={userDataDir=/tmp/.com.google.Chrome.rgDfCi},
takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true,
hasTouchScreen=false, version=45.0.2454.101, platform=LINUX,
browserConnectionEnabled=false, nativeEvents=true,
acceptSslCerts=true, locationContextEnabled=true,
webStorageEnabled=true, browserName=chrome, takesScreenshot=true,
javascriptEnabled=true, cssSelectorsEnabled=true}] Session ID:
a97aeb9a53ddd77e8edfac64019cc599 at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
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:647)
at
org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:311)
at
org.openqa.selenium.remote.RemoteWebDriver$RemoteNavigation.to(RemoteWebDriver.java:927)
at app.core.browsers.chrome.Chrome.navigateTo(Chrome.java:112) at
app.core.extensions.tests.ShouldPostToServerTest.nav(ShouldPostToServerTest.java:58)
at
app.core.extensions.tests.ShouldPostToServerTest.setTest(ShouldPostToServerTest.java:49)
Your code runs fine. Might be you using outdated chrome driver. I suggest to use latest exe of chrome driver.
This error message...
Connected to the target VM, address: '127.0.0.1:57086', transport: 'socket'
Starting ChromeDriver 2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b) on port 13817
.
org.openqa.selenium.WebDriverException: unknown error: cannot
determine loading status from timeout: Timed out receiving message
from renderer: 600.000 (Session info: chrome=45.0.2454.101)
(Driver info: chromedriver=2.20.353124
(035346203162d32c80f1dce587c8154a1efa0c3b),platform=Linux 3.19.0-28-generic x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 1200.01 seconds
Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09 13:08:06' System info: host: 'yogesh-ubuntu', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.19.0-28-generic', java.version: '1.8.0_60' Driver info: org.openqa.selenium.chrome.ChromeDriver
...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. Chrome Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Though your chromedriver=2.20 and chrome=45.0 are compatable.
But your JDK version is 1.8.0_60 which is pretty ancient.
So there is a clear mismatch between JDK v8u60 , Selenium Client v'2.48.2 , ChromeDriver v2.20 and the Chrome Browser v45.0
Solution
Ensure that:
JDK is upgraded to current levels JDK 8u241.
Selenium is upgraded to current levels Version 3.141.59.
ChromeDriver is updated to current ChromeDriver v80.0 level.
Chrome is updated to current Chrome Version 80.0 level. (as per ChromeDriver v80.0 release notes)
Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
If your base Web Client version is too old, then uninstall it through and install a recent GA and released version of Web Client.
Take a System Reboot.
Execute your #Test as non-root user.
Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
Code:
public void Test2() throws Exception{
Thread.sleep(5000);
driver.findElement(By.id("cboMenu")).click();
driver.findElement(By.xpath(".//*[#id='cboMenu/option[3]")).click();
}
Error:
org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"id","selector":"cboMenu"}
Command duration or timeout: 31 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'venu-PC', ip: '192.168.1.3', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_51'
Session ID: 0f859bed-35df-4eba-a472-3bc2efec4814
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Please use explicit wait instead of the Thread.sleep(5000), like in the next example.
It will provide you much clearer error regarding what you experience.
public void Test2() throws Exception{
new WebDriverWait(driver, 3).until(ExpectedConditions.visibilityOfElementLocated(By.id("cboMenu")))
driver.findElement(By.id("cboMenu")).click();
driver.findElement(By.xpath(".//*[#id='cboMenu/option[3]")).click();
}
Next, verify your button doesn't appear in different iFrame. If you do, change the iFrame to the one you element inside:
driver.switchTo().frame("IFRAME_ID");
The IFRAME_ID is taken from the DOM:
<iframe id="IFRAME_ID">
You can next change visibilityOfElementLocated to presenceOfElementLocated, that will verify that an element is present on the DOM but does not necessarily mean that the element is visible. It can be good clue to know if your webDriver is in the correct scope with the button you try to click.
Additional tip - scroll the button you want to click on into view. Thats could be also the reason to failure.
//element is WebElement
(JavascriptExecutor)driver.executeScript("arguments[0].scrollIntoView(true);", element);
this is solved my issue :)
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.context("WEBVIEW_com.openstream.cueme.services.workbench");
Thread.sleep(10000);
driver.findElementById("userId").sendKeys("sysadmin");
driver.findElementById("CuemePassword").sendKeys("MMNext13#");
Try below code
public void Test2() throws Exception{
Thread.sleep(5000);
driver.findElement(By.id("cboMenu")).click();
driver.findElement(By.xpath(".//*[#id='cboMenu']/option[3]")).click();
All:
I am running a simple Java application with Selenium WebDriver.
I was able to successfully run a search
on http://www.google.com using org.openqa.selenium.htmlunit.HtmlUnitDriver
I tried to run the same search term on http://www.yahoo.com as shown in the following code excerpt:
CharSequence[] searchTerm = { "bbc", "news" };
// Create a new instance of the html unit driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new HtmlUnitDriver();
// And now use this to visit Google
driver.get("http://www.yahoo.com");
// Find the text input element by its name
WebElement element = driver.findElement(By.name("q"));
//searchTerm = "bbc news";
// Enter something to search for
element.sendKeys(searchTerm);
// Now submit the form. WebDriver will find the form for us from the element
element.submit();
// Check the title of the page
System.out.println("Page title is: " + driver.getTitle());
driver.quit();
Howefver, it gives me the following error:
Oct 17, 2014 3:18:44 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected [DNR="deleted", version:0, domain:.www.yahoo.com, path:/, expiry:Thu Oct 17 15:18:45 IST 2013] Illegal domain attribute "www.yahoo.com". Domain of origin: "in.yahoo.com"
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element with name: q
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.43.1', revision: '5163bce', time: '2014-09-10 16:27:58'
System info: host: , ip: , os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_05'
Driver info: driver.version: HtmlUnitDriver
at org.openqa.selenium.htmlunit.HtmlUnitDriver.findElementByName(HtmlUnitDriver.java:1001)
Why does it work fine for http://www.google.com but fails for http://www.yahoo.com ?
Why does it throw the "Exception in thread main org.openqa.selenium.NoSuchElementException Unable to locate element with name q" error?
Update with Answer
Thanks to #Sriram and #ivan_ochc , I am able to run the following code that searches http://www.yahoo.com properly
// Create a new instance of the html unit driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new HtmlUnitDriver();
// And now use this to visit Google
driver.get("http://www.yahoo.com");
// Find the text input element by its name
WebElement element = driver.findElement(By.name("p"));
http://www.yahoo.com doesn't have element with name="q", it has element with name="p"
I'm using JUnit, Selenium WebDriver and try to make some tests with HtmlUnit and http://vk.com site but fail.
It looks like FirefoxDriver works great for me.
Here is code:
#Before
public void setUp() {
DesiredCapabilities capabilities = DesiredCapabilities.htmlUnit();
capabilities.setBrowserName("Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0");
capabilities.setVersion("24.0");
capabilities.setJavascriptEnabled(true);
driver = new HtmlUnitDriver(capabilities);
driver.manage().timeouts()
.implicitlyWait(Integer.parseInt(TIMEOUT), TimeUnit.SECONDS);
driver.get("http://vk.com");
}
#Test
public void SomeTest() {
/* LoginPage - described class in PageObject traditions */
LoginPage start = new LoginPage(driver);
LOG.info(driver.getPageSource());
//...
}
When I start it I get the an exception:
org.openqa.selenium.WebDriverException: com.gargoylesoftware.htmlunit.ScriptException: Exception invoking setInnerHTML
Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00'
System info: host: 'hera', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10-3-amd64', java.version: '1.6.0_27'
Driver info: driver.version: HtmlUnitDriver
at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:484)
at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:463)
at vk.Execution.setUp(Execution.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
Any suggestions?
ps. This is black-box testing I've no access to change internal code on site.
Different drivers have different ways to handle javascript.
Htmlunit uses Rhino and firefox-driver uses Firefox's default javascript handler and hence, you see different results with different drivers.
Replace htmlUnit() with firefox() for your fix.
DesiredCapabilities capabilities = DesiredCapabilities.firefox()
capabilities.setBrowserName("Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0");
capabilities.setVersion("24.0");
driver = new HtmlUnitDriver(capabilities);