Reputation:
I want to click a button which is actually a div tag. I am unable to click on it.
from selenium import webdriver
url = "https://www.qoo10.sg/item/LAPTOP-SCREEN-PROTECTOR-SCREEN-GUARD-FOR-13-14-15-INCHES-2ND/410235318"
driver = webdriver.Firefox()
driver.get(url)
elem = driver.find_element_by_class_name('selectArea').click()
when i run this program i go this error
selenium.common.exceptions.ElementNotInteractableException: Message: Element <div id="ship_to_outer" class="selectArea"> could not be scrolled into view.
Upvotes: 1
Views: 90
Reputation: 5647
As this screenshot us tells:
there are 4 elements with class name selectArea
. And the first one is invisible. That's why you are getting:
selenium.common.exceptions.ElementNotInteractableException: Message: Element <div id="ship_to_outer" class="selectArea"> could not be scrolled into view.
So, first of all you have to specify exactly which element you want to click on. For example first dropdown:
has id, and it could be found like this:
driver.find_element_by_id('inventory_outer_0').click()
Upvotes: 1
Reputation: 52685
There are 4 buttons with the same class name "ship_to_outer"
- the first one is hidden, so you cannot click it. Try below code instead
driver.find_element_by_xpath('//div[@class="selectArea" and not(@id="ship_to_outer")]').click()
Upvotes: 2