Automating tests to edge browser through webDriver using java script.
System.setProperty("webdriver.edge.driver",
"C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe");
WebDriver driver = new EdgeDriver();
Already install MicrosoftWebDriver
And using selenium webdriver 2.48.2
OS: Microsoft Windows [Version 10.0.10565]
But got and Exception:
Exception in thread "main"
org.openqa.selenium.remote.SessionNotFoundException: null (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.14 seconds
Build info: version: '2.48.2', revision: '41bccdd10cf2c0560f637404c2d96164b67d9d67', time: '2015-10-09 13:08:06'
System info: host: 'DESKTOP-DUHBOA4', ip: '192.168.31.26', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_45'
Driver info: org.openqa.selenium.edge.EdgeDriver
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:164)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:129)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:152)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:141)
at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:98)
at test.edge.browser.UseEdgeBrowser.main(UseEdgeBrowser.java:18)
No clue for this. Do I still need to configure something?
There are 2 kinds of
1. Microsoft WebDriver: https://www.microsoft.com/en-us/download/details.aspx?id=48212
and
WebDriver for Windows Insiders: http://www.microsoft.com/en-us/download/details.aspx?id=48740
using 1 with this issue. using 2 works for me
It's some time ago, but here is the solution for everyone with the same error..
Your Windows build must be equal to the Microsoft WebDriver version(eg 14393). Just open start menu, type in "winver" and use the correct WebDriver (right hand side) on following page:
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Related
Recently I upgraded to Selenium 3.7.
Code:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public static void main (String args[]){
System.setProperty("webdriver.gecko.driver",
"/usr/local/bin/geckodriver");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
driver.quit();
}
Included Library:
selenium-java-3.7.1/selenium-server-standalone-3.7.1.jar
selenium-java-3.7.1/libs/httpcore-4.4.6.jar
selenium-java-3.7.1/libs/httpclient-4.5.3.jar
selenium-java-3.7.1/libs/guava-23.0.jar
selenium-java-3.7.1/libs/gson-2.8.2.jar
selenium-java-3.7.1/libs/commons-logging-1.2.jar
selenium-java-3.7.1/libs/commons-exec-1.3.jar
selenium-java-3.7.1/libs/commons-codec-1.10.jar
selenium-java-3.7.1/libs/byte-buddy-1.7.5.jar
selenium-java-3.7.1/client-combined-3.7.1.jar
selenium-java-3.7.1/client-combined-3.7.1-sources.jar
System environment:
Firefox 56.0.2
Java 1.8
selenium-java-3.7.1
selenium-server-standalone-3.7.1
geckodriver - v0.19.1
Error trace log:
Usage:
/usr/local/bin/geckodriver [OPTIONS] /usr/local/bin/geckodriver:
Unknown option --port=8970 Exception in thread "main"
org.openqa.selenium.WebDriverException:
org.apache.http.conn.HttpHostConnectException: Connect to
localhost:8970 [localhost/0:0:0:0:0:0:0:1,
localhost/fe80:0:0:0:0:0:0:1%1] failed: Connection refused (Connection
refused) Build info: version: '3.7.1', revision: '8a0099a', time:
'2017-11-06T21:07:36.161Z' System info: host:
'Maggies-MacBook-Pro-2.local', ip: '192.168.1.6', os.name: 'Mac OS X',
os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
Any idea would be appreciated. Thank you.
Update after trying Debanjan suggestion:
Code:
public static void main (String args[]){
System.out.println("Debug 1");
System.setProperty("webdriver.gecko.driver",
"/Users/maggie/Documents/ToolsQA/Libs/geckodriver");
System.out.println("Debug 2");
WebDriver driver = new FirefoxDriver();
System.out.println("Debug 3");
driver.get("http://www.google.com");
driver.quit();
}
Include Library:
selenium-server-standalone-3.7.1.jar
System Environment:
Firefox 56.0.2
Java 1.8
selenium-java-3.7.1
selenium-server-standalone-3.7.1
geckodriver 0.19.1
Mac OS X', os.arch: 'x86_64', os.version: '10.12.6'
Error trace log:
Debug 1 Debug 2 Starting ChromeDriver 2.33.506106
(8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2) on port 2198 Only local
connections are allowed. Exception in thread "main"
org.openqa.selenium.WebDriverException: Timed out waiting for driver
server to start. Build info: version: '3.7.1', revision: '8a0099a',
time: '2017-11-06T21:07:36.161Z' System info: host:
'Maggies-MacBook-Pro-2.local', ip: '192.168.1.6', os.name: 'Mac OS X',
os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_121'
Driver info: driver.version: ChromeDriver at
org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:192)
at
org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178)
at
org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at
org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at
org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181)
at
org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:168)
at
org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123)
at AutomationFrameWork.FirstTestCase.main(FirstTestCase.java:13)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed
out waiting for [http://localhost:2198/status] to be available after
20005 ms at
org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
at
org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:187)
... 9 more Caused by: java.util.concurrent.TimeoutException at
java.util.concurrent.FutureTask.get(FutureTask.java:205) at
com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:147)
at
org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
... 10 more
The error WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:8970 can occur due to different reasons.
More over there is a discrepency in your Included Library list as selenium-server-standalone-3.7.1.jar is never a part of downloaded selenium-java-3.7.1.zip.
Try out the steps mentioned below:
From the Included Library list remove all the jars.
Download and Add only selenium-server-standalone-3.7.1.jar from this link or from this link
Ensure that /etc/hosts on your system contains the following entry :
1 127.0.0.1 localhost.localdomain localhost
Run CCleaner Tool to wipe away all the OS chores from your system.
You can opt for a System Reboot.
Execute your Test.
I tried with the same versions without any problem.
If the path to the geckodriver:
System.setProperty("webdriver.gecko.driver",
"/usr/local/bin/geckodriver");
is correct, make sure that the geckodriver is executable for the user that execute the code:
chmod +x geckodriver
After doing some research, I manage to resolve this problem.
The error is due to the 127.0.0.1 map to localhost.com in etc/hosts.
Edited:
127.0.0.1 localhost
I think you are missing the .exe extension. Your path should be like this
System.setProperty("webdriver.gecko.driver",
"/usr/local/bin/geckodriver.exe");
I am trying to open a Chrome browser window with an existing user profile.
String dir= "/Users/labuser/Library/Application Support/Google/Chrome";
ChromeOptions options = new ChromeOptions();
options.addArguments("--user-data-dir="+dir);
driver = new ChromeDriver(options); // throws an exception!
I confirmed the user directory path by looking at chrome://version page. (screenshot below)
Due to some reason, this code throws an exception with very less information
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.33.506106 (8a06c39c4582fbfbab6966dbb1c38a9173bfb1a2),platform=Mac OS X 10.12.6 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.33 seconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:00:58'
System info: host: 'arustagi-wx-3', ip: '10.41.25.35', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.6', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
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:423)
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.startSession(RemoteWebDriver.java:249)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:170)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:159)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:148)
Edit
I am using the following chrome browser, this falls in the supported range of browsers
Version 61.0.3163.100
You are using the latest version of the ChromeDriver
chromedriver=2.33.506106
with Selenium 2.53. You should use the latest release.
Anyway, what is your browser version? Here you can take a look which are the browsers version supported (based on your chromedriver).
EDIT
I tried with:
Selenium 3.5.3
ChromeDriver v2.33
Google Chrome Version 62.0.3202.62 (Official Build) (64-bit)
From chrome://version/, my profile path is
/Volumes/MacintoshSSD/Users/DurdenP/Library/Application Support/Google/Chrome/Default
Trying
String chromeDriver ="pathTo/ChromeDriver/chromedriver";
System.setProperty("webdriver.chrome.driver", chromeDriver);
ChromeOptions options = new ChromeOptions();
String dir= "/Volumes/MacintoshSSD/Users/DurdenP/Library/Application Support/Google/Chrome";
options.addArguments("user-data-dir="+dir);
ChromeDriver driver = new ChromeDriver(options);
it works.
Finally got this fixed. I was working on macOS and found out that i needed to quit the browser cleanly.
After closing the browser window, i had to right click on the icon in the dock and press quit. The selenium script would work perfectly fine after this.
Seem to be getting this error waiting for popup window. As I am watching the script execute the js button executes and popup window does open but my test fails with the following error:
org.openqa.selenium.WebDriverException: disconnected: received Inspector.detached event
(Session info: chrome=56.0.2924.87)
(Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3.20 seconds
Build info: version: '2.53.1', revision: 'a36b8b1cd5757287168e54b817830adce9b0158d', time: '2016-06-30 19:26:09'
System info: host: '*******', ip: '*******', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_91'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.28.455520
This is about chrome issue(https://bugs.chromium.org/p/chromedriver/issues/detail?id=1194).
When you are running selenium program, you cannot press F12 to open dev tools manually, or it'll throw this exception sometimes. You can browse this chrome driver official page.
According to the issue list, it looks like fixed, but I still meet this bug in ChromeDriver 2.29.
Try updating your Chrome, I can see that your chromedriver version is 2.28 which is the most recent release and it should support Chrome v55-77, but updating Chrome might be a solution.
I have an android activity with webview.
However appium 1.4.16 cannot recognize this context.
My android device is with Android 4.2
myAndroidDriver.getContextHandles() ==> return list of size 1
I have read two solutions for that:
1) set
setWebContentsDebuggingEnabled = true;
2) set selendrium mode
a) What does "selendroid mode" really means?
appium not using UIAutomator? Will this affect other tests I have?
b) I have tried this before, but the code execution fails
when I add:
capabilities.setCapability("automationName", "Selendroid");
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: hasInternetPermissionFromManifest failed. Error: Command failed: /bin/sh -c /Users/eladb/MyWorkspace/sdk/build-tools/android-4.4/aapt dump badging
ERROR: no dump file specified
) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 3.54 seconds
Build info: version: '2.47.1', revision: 'unknown', time: '2015-07-30 11:02:44'
System info: host: 'eladb-macbookpro.roam.corp.google.com', ip: '100.105.45.192', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.2', java.version: '1.8.0_25'
Driver info: com.waze.mobileautomation.common.android.MyAndroidDriver
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:408)
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:595)
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.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:128)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:141)
at io.appium.java_client.DefaultGenericMobileDriver.(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:160)
at io.appium.java_client.AppiumDriver.(AppiumDriver.java:168)
Try:
driver.switchTo().window("WEBVIEW");
Where driver is an AndroidDriver and your CapabilityType.BROWSER_NAME is set to "" (empty)
I received error message with new windows as "Internet explorer has stopped working "
I tried by enable/disable protect mode for all zones , google help solutions . I download IEDriverServer_x64_2.42.0 and selenium-java-2.42.2. I have added jar files from selenium 2.4.2 to my project library by add build path .
my code is :
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
capabilities.setPlatform(Platform.WINDOWS);
capabilities.setCapability("silent", true);
System.setProperty("webdriver.ie.driver", "C:\\IEDriverServer_x64_2.42.0\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
I am not able to open IE browser in Windows7 Server 64 bit ,IE 9 Version.
I am able to open all browsers including IE in windows8, IE11 Versions .
I have attached screenshot with error message and code .
I will share my screen over team viewer .
Below is the error log:
Started InternetExplorerDriver server (64-bit)
2.42.0.0
Listening on port 2878
Exception in thread "main" org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070012 ('There are no more files.') for URL 'localhost:2878/'
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 21.72 seconds
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:30'
System info: host: 'ASD-T-MADHUA1', ip: '192.168.0.30', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_05'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
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:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:162)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:225)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:182)
at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:174)
at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:146)
at UIControls.InternetExplorer.main(InternetExplorer.java:41)