Chrome Browser not opening in Selenium Webdriver - java

My chrome browser not opening in Selenium Webdriver .I have downloaded all things like chrome driver , selenium jars and chrome according to compatibility. I am using Intellij IDEA IDE.The code and version details are given below -
System.setProperty("webdriver.chrome.driver","C:\driver\chromedriver_win32.exe");
WebDriver driver = new ChromeDriver();
Versions:
Chrome:89.0.4389.90
IDE:IntelliJ IDEA : 203.7148.57
Chrome driver: https://chromedriver.storage.googleapis.com/index.html?path=89.0.4389.23/
Selenium Webdriver: selenium-java-4.0.0-beta-2
(I have tried with selenium old version as well)
Please give some suggestions .
Thanks .

Remove _win32 and than try
System.setProperty("webdriver.chrome.driver","C:\driver\chromedriver.exe");
WebDriver driver = new ChromeDriver();

Related

Selenium webdriver is looking at wrong path for Chrome.exe

I am trying to launch chrome.exe from selenium webdriver i have chrome installed on my machine and chromedriver path is also given in code but selenium webdriver for java is looking for chrome.exe on wrong path and giving error and not launching browser.
I have tried options class to locate the chrome.exe with the actual path of chrome.exe but not working for me.I have done required imports as well but still no success.
I have tried below selenium webdriver java code
public class News24Test
{
public static void main(String[] args) throws Exception
{
System.setProperty("webdriver.chrome.driver","C://News24SA//ChromeDriver//chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setBinary("C://Program Files(x86)//Google//Chrome//Application//chrome.exe"); // Provide absolute executable chrome browser path with name and extension here
WebDriver driver = new ChromeDriver(options);
driver.manage().window().maximize();
driver.get("http://www.news24.com");
}
}
Selenium is looking at below path which is wrong path
C:\Users\orestip\LocalSettings\Application Data\Google\Chrome\Application\chrome.exe
Try setting the options first:
ChromeOptions options = new ChromeOptions();
options.setBinary("C:\\Program Files(x86)\\Google\\Chrome\\Application\\chrome.exe");
System.setProperty("webdriver.chrome.driver","C:\\News24SA\\ChromeDriver\\chromedriver.exe");
WebDriver driver = new ChromeDriver(options);
Make sure the chromedriver version and the chrome browers versions match.
You can either update your chrome browser to match the driver version or you can choose a chromedriver that matches your browser version.
Hi so old question but if anyone else is a bit stumped by this, I'll give my take.
So, you may one day have a working chromedriver and then it suddenly just stops working. What actually happens is Chrome updates behind the scenes and makes it out of date.
What you need to do is update your chromedriver so it matches your actual, normal Chrome installation.

When the below code is executed, firefox is showing error. I am using the latest version of java, eclipse, firefox, and WebDrive jar file

System.setProperty("webdriver.gecko.driver", "C:\\Users\\vinil\\Downloads\\geckodriver-v0.11.1-win64\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("http://www.jobserve.com/in/en/Job-Search/");
driver.findElement(By.xpath("//*[#id='ddcl-selInd']/span/span")).click();
Thread.sleep(5000);
driver.quit();
[]
This happens on driver.quit() when you are closing the browser.
It is unfortunately known issue when quitting geckodriver firefox instance, see this links for details.
https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/7506 https://bugzilla.mozilla.org/show_bug.cgi?id=1027222

Chrome browser is not opening in selenium webdriver

My code is not launching browser.
Project show running for a long time, but nothing happens. I pushed print and observed that WebDriver driver = new ChromeDriver(); is not getting executed.
package seleniumautomation;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
public class seleniumautomation {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","D:/selenium_java/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.navigate().to("https://www.zaakpay.com/");
}
}
After some debugging, I am getting this new error:
I added manifest_vesion, but in every run, it is generating a new file and i am again getting same error.
Download jar from: http://chromedriver.storage.googleapis.com/index.html?path=2.23/
System.setProperty("webdriver.chrome.driver",
"<Downloaded file location>");
WebDriver driver = new ChromeDriver();
driver.get("https://www.zaakpay.com/");
Then, it will work.
To use Chrome Browser needs to System.setPropert("webdriver.chrome.driver","PATH")
The ChromeDriver is maintained / supported by the Chromium project iteslf. WebDriver works with Chrome through the chromedriver binary.
Download Link of ChromeDriver : LINK
You need to add chromedriver.exe(can be downloaded from http://www.seleniumhq.org/download/) to your project. Along with it, you need to add following lines in your code:
System.setProperty("webdriver.chrome.driver", PATH_TO_EXE_FINAL);
capabilities= DesiredCapabilities.chrome();
capabilities.setBrowserName(DesiredCapabilities.chrome().getBrowserName());
Use following code snippet to launch chrome driver.
System.setProperty("webdriver.chrome.driver", PATH_TO_EXE_FINAL);
ChromeOptions opt = new ChromeOptions();
opt.addArguments("disable-extensions");
opt.addArguments("--start-maximized");
WebDriver driver = new ChromeDriver(opt);
I solved the issue by changing my OS windows 10 language to english. selenium methods can not execute some other languages. If in both IE, geckodriver and chrome you are having the same issue it is language problem I can asuure you
enter image description hereTrying to check the version you installed in web driver and the version you currently use in you chrome

Selenium not able to identify the newly opened window in the IE browser

I am not able to identify a newly opened window in my application.
After using driver.get("my app url") when I try to click on any object, I am getting org.openqa.selenium.NoSuchWindowException: Unable to find element on closed window.
I replicated the same issue on flipkart website using the below code :
System.setProperty("webdriver.ie.driver","path to IEDriverServer.exe);
WebDriver driver = new InternetExplorerDriver();
driver.get("https://www.flipkart.com");
Thread.sleep(10000); // just for sample
driver.findElement(By.linkText("24x7 Customer Care")).click();
But when I run it I am getting NoSuchWindowException.
It is working fine in chrome and Firefox browser.
Selenium Version =2.53.0 ,
OS= Windows7
I tried by adding ignoreProtectedMode and IntroduceFlakinessByIgnoringSecurityDomains capabilities as well but even that is working.
Kindly assist.
Use this it works for you
System.setProperty("webdriver.ie.driver", "path to IEdriverServer.exe" );
WebDriver driver =new InternetExplorerDriver();
driver.manage().window().maximize();
driver.get("https://www.flipkart.com");

Selenium compatability with Firefox and Chrome

I am able to run the script successfully on Firefox and i am not able to run the same script on Chrome. Please help me in finding these issue.
Thanks
Hi to run test in chrome please call chrome driver like below
// call the Chrome driver as below first
System.setProperty("webdriver.chrome.driver", "D:\\eclipseProject\\##\\src\\com\\##\\chromedriver_win32\\chromedriver.exe");
// path to chrome exe that you have downloaded form given url (below)
driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("http://www.seleniumhq.com"); // link to your web-table web page
now your script as same on firfox
// download chrome exe form this link http://docs.seleniumhq.org/download/

Categories