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 in Selenium by Rajnesh
79 views

2 answers to this question.

0 votes
Xpath is wrong try this
//*[@id='sdHeader']
answered Feb 7 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 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,130 points
1,320 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,130 points
319 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,050 points
403 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
758 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
400 views