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,510 points

edited Apr 19, 2018 by Damon Salvatore 169 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,420 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 26, 2018 in Selenium by nsv999
• 5,090 points
1,084 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 20, 2018 in Selenium by king_kenny
• 3,650 points
342 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,650 points
424 views
0 votes
1 answer

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,090 points
761 views
0 votes
1 answer
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,130 points
1,001 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
713 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,420 points
8,574 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 27, 2018 in Selenium by Meci Matt
• 9,420 points
2,279 views