Error ElementNotVisibleException in selenium

0 votes

Hello, I am trying to automate the process of buying a product from snapdeal but in the first step itself I am getting an error saying:-

Error:ElementNotVisibleException no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="sdHeader"]/div[2]/button"}
  (Session info: chrome=71.0.3578.98)
WebDriver driver = new ChromeDriver();
driver.get("https://www.snapdeal.com");
driver.findElement(By.xpath("//*[@id=\"sdHeader\"]/div[2]/button")).sendKeys("Adidas Shoes",Keys.ENTER);

This is the code I am using

Feb 7, 2019 in Selenium by Rajnesh
727 views

2 answers to this question.

0 votes
Xpath is wrong try this
//*[@id='sdHeader']
answered Feb 7, 2019 by anonymous
0 votes
The xpath that you are using is wrong. Try using the proper xpath for the search. You can directly get the xpath by clicking on the element and copying the xpath or you can also use chropath for getting all the different locators like css_selector, relative xpath and absolute xpath.

Hope this helps.
answered Feb 8, 2019 by Disha

Related Questions In Selenium

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How to eliminate this error”Cannot instantiate the type Select in selenium webdriver”

Try below code. Select sc = new Select(driver.findElement(By.xpath("your ...READ MORE

answered May 18, 2018 in Selenium by Samarpit
• 5,890 points
5,332 views
0 votes
1 answer

Error in for loop to fetch data from excel in selenium

You are closing theFileInputStream inside the for-loop. ...READ MORE

answered Jun 20, 2018 in Selenium by Samarpit
• 5,890 points
1,934 views
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,520 points
4,651 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,010 points
5,488 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,890 points
3,317 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 2, 2020 in Selenium by Sri
• 3,010 points
3,928 views