OS: Windows 10 Selenium Version: 3.11 Browser: Internet Explorer, Firefox, Opera, Chrome
Browser Version:
Expected Behavior - The program should launch all the browsers, open websites and perform operations intended.
Actual Behavior - The program behaves inconsistently during opening of browsers, sometimes throwing errors and failing to launch browsers. Error log can be found below (for one sample run):
Apr 09, 2018 12:09:21 AM org.openqa.selenium.remote.DesiredCapabilities chrome
INFO: Using new ChromeOptions() is preferred to DesiredCapabilities.chrome()
Test for the browser IE failed for website youtube
Exceptionorg.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z'
System info: host: 'ADMIN-PC', ip: '192.168.1.5', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: InternetExplorerDriver
Test for the browser chrome failed for website google
Exceptionorg.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z'
System info: host: 'ADMIN-PC', ip: '192.168.1.5', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: InternetExplorerDriver
Test for the browser Internet Explorer failed for website google
Test for the browser Opera failed for website google
Exception observedorg.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z'
System info: host: 'ADMIN-PC', ip: '192.168.1.5', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: googleOperaDriver
Exceptionorg.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z'
System info: host: 'ADMIN-PC', ip: '192.168.1.5', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: ChromeDriver
Test for the browser Firefox failed for website google
Exceptionorg.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:23410
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z'
System info: host: 'ADMIN-PC', ip: '192.168.1.5', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_161'
Driver info: driver.version: FirefoxDriver
Steps To Reproduce the error -
Sample Program (Please copy following files in eclipse and execute the program)
File 1
public class browserAutomation1 {
public static void main(String[] args) {
Thread googleOpera = new Thread(new GoogleOpera(), "GoogleOperaThread");
googleOpera.start();
Thread googleFirefox = new Thread(new GoogleFirefox(), "GoogleFirefoxThread");
googleFirefox.start();
Thread googleIE = new Thread(new GoogleIe(), "GoogleIEThread");
googleIE.start();
Thread googleChrome = new Thread(new GoogleChrome(), "GoogleChromeThread");
googleChrome.start();
//Thread youtubeIE= new Thread(new youtubeIE(),"YoutubeThread");
//youtubeIE.start();
}
}
File 2
package samplePrograms;
import java.io.File;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.opera.OperaDriver;
import org.openqa.selenium.opera.OperaOptions;
public class GoogleOpera extends browserAutomation1 implements Runnable {
public void run() {
System.setProperty("webdriver.opera.driver", "C:\\Marionette\\operadriver_win32\\operadriver.exe");
OperaOptions options = new OperaOptions();
options.setBinary(new File("C:\\Program Files\\Opera\\51.0.2830.55\\opera.exe"));
try {
WebDriver driver = new OperaDriver(options);
driver.get("https://www.google.com");
} catch (Exception e) {
System.out.println(e);
}
}
}
File 3
package samplePrograms;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class GoogleChrome extends browserAutomation1 implements Runnable {
public void run() {
System.setProperty
("webdriver.chrome.driver", "C:\\Marionette\\chromedriver_win32_New\\chromedriver.exe");
try {
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");
} catch (Exception e) {
System.out.println(e);
}
}
}
File 4
package samplePrograms;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxDriverLogLevel;
import org.openqa.selenium.firefox.FirefoxOptions;
public class GoogleFirefox extends browserAutomation1 implements
Runnable {
public void run() {
System.setProperty("webdriver.gecko.driver", "C:\\Marionette\\geckodriver.exe");
try {
FirefoxOptions options = new FirefoxOptions();
options.setLogLevel(FirefoxDriverLogLevel.DEBUG);
WebDriver driver = new FirefoxDriver(options);
driver.get("https://www.google.com");
} catch (Exception e) {
System.out.println();
}
}
}
File 5
package samplePrograms;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
public class GoogleIe extends browserAutomation1 implements Runnable {
public void run() {
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(CapabilityType.BROWSER_NAME, "IE");
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
System.setProperty("webdriver.ie.driver", "C:\Marionette\IEDriverServer_Win32_3.9.0\IEDriverServer.exe");
try {
WebDriver driver = new InternetExplorerDriver();
driver.get("https://www.google.com");
} catch (Exception e) {
System.out.println(e);
}
}
}
Hope this helps to understand the program output and the error.