Not able to set ChromeDriver to run a TestNG programm

0 votes

I am new to Selenium TestNG and I am not willing to use firefox browser, Instead, I want to use ChromeDriver. I am getting an error when I try to set it as the web driver.

Here's the code:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.Test;

public class TestNG123 {
System.setProperty("webdriver.chrome.driver","D:\\chromedriver");
        WebDriver driver = new ChromeDriver();
        String URL = "https://accounts.google.com";
Apr 19, 2018 in Selenium by Damon Salvatore
• 5,980 points

edited Apr 19, 2018 by Damon Salvatore 2,421 views

1 answer to this question.

0 votes

You have not set the system properties correctly. when you are setting the path for the chrome driver, you must add .exe to it, as shown below:

public class TestNG123 {
System.setProperty("webdriver.chrome.driver","D:\\chromedriver.exe");
        WebDriver driver = new ChromeDriver();
        String URL = "https://accounts.google.com";
answered Apr 19, 2018 by Meci Matt
• 9,460 points

Related Questions In Selenium

0 votes
1 answer

Selenium ChromeDriver issue - Want to run it in background, but not as headless browser

This is a flaw with ChromeDriver. Tried ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,500 points
7,926 views
0 votes
1 answer

Not able to run WebDriver test with Google Chrome.

Firefox is just default browser for tests ...READ MORE

answered Apr 21, 2018 in Selenium by king_kenny
• 3,710 points
2,052 views
+3 votes
1 answer

Not able to run in chrome

There is a very silly mistake in ...READ MORE

answered May 15, 2018 in Selenium by king_kenny
• 3,710 points
1,458 views
0 votes
1 answer
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,494 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,031 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,145 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,816 views
0 votes
1 answer

Not able to open a new URL in a new tab in Selenium

There is a bug in ChromeDriver that ...READ MORE

answered May 21, 2018 in Selenium by Meci Matt
• 9,460 points
18,589 views
0 votes
1 answer

Is it possible for a website to detect that we are using Selenium with ChromeDriver

Selenium tests for pre-defined javascript variables which ...READ MORE

answered Apr 28, 2018 in Selenium by Meci Matt
• 9,460 points
6,078 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP