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 8, 2019 in Selenium by Rajnesh
1,324 views

2 answers to this question.

0 votes
Xpath is wrong try this
//*[@id='sdHeader']
answered Feb 8, 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
+1 vote
4 answers
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,910 points
9,546 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,910 points
3,628 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,500 points
12,617 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
8,572 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
6,629 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,519 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