Bbb
Bbb

Reputation: 117

Selecting class name in Python with Selenium

I'm trying to click in the area 5 pixels below a class name on a web page.

This is the code :

homeLink = driver.find_element_by_class_name('*****')
action = webdriver.common.action_chains.ActionChains(driver)
action.move_to_element_with_offset(homeLink, 0, 5) 
action.click()
action.perform()

The error: "Message: no such element: Unable to locate element: {"method":"class name","selector":"*****"}"

The html:

<div class="*****">Internal Tags</div>

Upvotes: 0

Views: 225

Answers (1)

Ishita Shah
Ishita Shah

Reputation: 4035

You may refer this,

homeLink = driver.find_element_by_xpath("//div[@class='*****' and contains(text(),'Internal Tags')]")
action=ActionChains(driver)
action.move_to_element(homeLink).click().perform() 

Upvotes: 1

Related Questions