I am trying to execute Selenium on Ubuntu Server but I have always problem with driver version. I don't know more options to check it so I am here to try to solve this.
First the environment:
Maven : Apache Maven 3.3.9
Java : 1.8
Chrome : Google Chrome 59.0.3071.115
Chrome driver : ChromeDriver 2.30.477691
When I try to execute mvn clean test, it returns this ERROR:
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'ubuntu-2gb-lon1-01', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-81-generic', java.version: '1.8.0_131'
Driver info: driver.version: ChromeDriver
The simple java code is this:
System.setProperty("webdriver.chrome.driver", "chromedriver");
WebDriver driver = new ChromeDriver();
driver.get("https://google.es");
driver.quit();
Could anyone help to me to install a Chrome driver version to solve this?
I think that I am not doing this correctly.
Regards!
System.setProperty("webdriver.chrome.driver", "Driver Path");
Here you have to pass the path where your driver is located in your disk.
Related
I'm using a macOS, I installed the Edge webdriver on it, configured its path on my selenium framework
But I got this error:
org.openqa.selenium.WebDriverException: unknown error: cannot find Microsoft Edge binary
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'MacBook-Pro-de-Sabrine-2.local', ip: 'fe80:0:0:0:4c2:e6bc:d2ff:348c%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.14.5', java.version: '1.8.0_191'
Driver info: driver.version: EdgeDriver
So you are using MAC. The problem is that the browser needs to be installed on your system in order to run it.
So if somehow you have installed it use the below code:
Code:
System.setProperty("webdriver.edge.driver","/YOUR_PATH");
WebDriver driver = new EdgeDriver();
driver.get("http://www.google.com");
OR
System.setProperty("webdriver.edge.driver","YOUR_PATH");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary("/YOUR_PATH");
EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);
WebDriver driver = new EdgeDriver(edgeOptions);
driver.get("http://www.google.com");
Below code I written to open www.google.com under selenium standalone Grid environment. During the execution it shows error
CONFIGURATION:
OS: WINDOWS 10
BROWSER : FireFox (66.0.3)
Selenium Standalone Command:
java -Dwebdriver.gecko.driver=C:\eClipse\jar\Selenium\geckodriver\geckodriver.exe -jar selenium-server-standalone-3.141.59.jar -role standalone
ERROR:
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'QAT2', ip: '10.1.6.79', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: driver.version: unknown
I try to google this exception but not find any clue to solve it. Can I have any solution for this.
CODE:
public class GridSetup {
private String baseUrl ;
private String nodeURL ;
public WebDriver wDriver ;
public static void main() throws MalformedURLException{
baseUrl = "http://www.google.com";
nodeURL = "http://localhost:4444/wd/hub";
System.setProperty("webdriver.gecko.driver","C:\\eClipse \\geckodriver.exe");
DesiredCapabilities caps = DesiredCapabilities.firefox();
System.out.println( "#####################");
caps.setBrowserName("firefox");
caps.setCapability("marioneete", true);
caps.setPlatform(Platform.WIN10);
caps.setVersion("66.0.3");
wDriver = new RemoteWebDriver(new URL(nodeURL), caps);
wDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
wDriver.get(baseUrl);
}
}
This error message...
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'QAT2', ip: '10.1.6.79', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91'
Driver info: driver.version: unknown
...implies that the GeckoDriver was unable to initiate/spawn a new WebBrowsing Session i.e. Firefox Browser session.
Your main issue is the incompatibility between the version of the binaries you are using as follows:
Your Selenium Client version is 3.141.59.
Your JDK version is 1.8.0_91 which is pretty ancient.
So there is a clear mismatch between the JDK v8u91 , Selenium Client v3.141.59.
Solution
Upgrade JDK to recent levels JDK 8u202.
i am setting up a selenium based testing application. I am using chrome driver for testing.
I have set up a docker image as in the below URL.
https://github.com/Leafney/alpine-selenium-chrome/blob/master/Dockerfile
I have configured the chrome driver property as follows.
System.setProperty("webdriver.chrome.driver", "/usr/lib/chromium/chromedriver");
However, I get the below error informing that chrome failed to start.
Command duration or timeout: 60.07 seconds
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'c34db8dbfca2', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.9.27-moby', java.version: '1.8.0_151'
Driver info: driver.version: ChromeDriver
unknown error: Chrome failed to start: crashed
Any pointers on this will be helpful.
I had the same issue with Chromedriver and Alpine, Chromedriver is not executable at all, even I had tried to install and run almost every version of the Chromedriver, no luck.
And then I had to use Debian Linux in order to execute Chromedriver properly for e2e testing in docker and CI.
I have tried with all version of Firefox 45, 48, 49, and 50. I also have to mention the path for the Gecko driver (64 bit) in my program, but still the Firefox browser is not opening once I run my program. I am using Selenium 3.0.1 Java version.
Here is my code:
System.setProperty("webdriver.gecko.driver", "C:\\Users\\Desktop\\ecpipse2\\Selenium Library files\\geckodriver.exe");
driver = new FirefoxDriver();
baseUrl = "http://automationpractice.com/index.php";
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
The following error is coming:
org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:45120 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
Build info: version: 'unknown', revision: '1969d75', time: '2016-10-18 09:43:45 -0700'
System info: host: 'LAPTOP-C07CIJJB', ip: '192.168.0.6', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_102'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
If the Gecko driver version is not correct then it doesn't establish a connection with Firefox.
In the above question, the mentioned error was a little bit confusing which doesn't say about Gecko driver is not compatible with the Selenium web driver and Firefox version.
My case now: It's working fine with Firefox 49.0.2, Selenium webDriver 3.0.1, and Geckodriver.exe 0.11.1.
You can see a working example here.
The following combination worked fine for me:
Firefox: 50
selenium-java: 3.0.1
JUnit: 4.12
geckodriver.exe: 11.1
Selenium 3.0 Firefx Driver fails with org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session.
System.setProperty("webdriver.gecko.driver", "..<Path>../geckodriver.exe");
capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
driver = new FirefoxDriver(capabilities);
Caused by: org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions#23aa363a, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions#23aa363a, version=, platform=ANY}], required capabilities = Capabilities [{}]
Build info: version: '3.0.0', revision: '350cf60', time: '2016-10-13 10:48:57 -0700'
System info: host: 'D202540', ip: '10.22.19.193', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_45'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
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:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:241)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:259)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:247)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:242)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:135)
this issue is solved with geckodriver 0.15 and selenium 3.3 version.
You need to download geckodriver. And then set
System.setProperty("webdriver.gecko.driver", "path\\to\\geckodriver.exe")
Check this link.
I had the same problem and fixed it with this. It seems it could not find the firefox binary
capabilities.setCapability("firefox_binary","C:\\Program Files\\Mozilla Firefox\\firefox.exe");
Same problem here. It was solved opening Eclipse/Netbeans with admin privileges.
This worked (linux mint, opensuse thumbleweed, win7)
with
libraryDependencies += "org.seleniumhq.selenium" %
"selenium-firefox-driver" % "3.0.1"
geckodriver.exe -V
geckodriver 0.13.0
if (System.getProperty("os.name").toLowerCase().contains("linux")) {
println("загружены настройки os.name=linux")
System.setProperty("webdriver.chrome.driver", "bin/chromedriver")
System.setProperty("webdriver.gecko.driver", "bin/geckodriver")
}else{
System.setProperty("webdriver.chrome.driver", "bin\\chromedriver.exe")
System.setProperty("webdriver.gecko.driver", "bin\\geckodriver.exe")
System.setProperty("webdriver.ie.driver", "bin\\IEDriverServer.exe")
System.setProperty("webdriver.edge.driver", "C:\\Program Files (x86)\\Microsoft Web Driver\\MicrosoftWebDriver.exe")
System.setProperty("webdriver.opera.driver", "c:\\XXX\\operadriver.exe")
System.setProperty("webdriver.opera.path","""C:\\Users\\user\\AppData\\Local\\Programs\\Opera""")
System.setProperty("webdriver.opera.binary","""C:\\Users\\user\\AppData\\Local\\Programs\\Opera\\launcher.exe""")
//
}
...
case
"firefox" => {
println(" подгружаем Веб-драйвер: geckodriver")
//iniprofile = new ProfilesIni()
//ffprofile = iniprofile.getProfile("default")
dc = DesiredCapabilities.firefox()
dc.setCapability("gecko", true) // как выйдет драйвер, так и установить
// dc.setCapability(FirefoxDriver.PROFILE, ffprofile); //FirefoxDriver.PROFILE = “firefox_profile”;
remote = new FirefoxDriver(dc)
}
but, for Remotewebdriver-connection if previous session failed,cancelled or aborted we get error:
[info] XXXX.E011_WebDB6292 *** ABORTED ***
[info] org.openqa.selenium.SessionNotCreatedException: Session is already started (WARNING: The server did not provide any stacktrace information)
[info] Command duration or timeout: 0 milliseconds
[info] Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
[info] System info: host: 'XXXX', ip: '172.16.4.125', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_11'
[info] Driver info: driver.version: RemoteWebDriver
[info] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
I ran into the same problem today, and it appears that not being admin on my laptop is actually an issue. To resolve it
Install in a non admin way Firefox (just need to click on no when Windows ask for privilege elevation)
Use the exe path (for my system something like C:\\Users\\MyUserName\\AppData\\Local\\MozillaFirefox\\firefox.exe).
It actually solved the issue.
Alternatively if you dont want to download the Gecko driver, you can downgrade the Firefox version to 44.
https://support.mozilla.org/t5/Install-and-Update/Install-an-older-version-of-Firefox/ta-p/1564
If you are using the latest GekoDriver then better to update the Selenium library versions as well.
The above issue is related to the Selenium version.