0

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>
Bbb
  • 117
  • 9
  • And what is your question? – Andersson Oct 11 '18 at 18:01
  • @Andersson How to fix the error – Bbb Oct 11 '18 at 18:03
  • Try to implement [Wait](https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp#explicit-and-implicit-waits) or check if element located inside an iframe – Andersson Oct 11 '18 at 18:04
  • What is `*****`? Normally, in HTML, the class attribute is a **space-separated list** of classes, and the method `find_element_by_class_name()` takes **one** of those classes. – SiKing Oct 11 '18 at 18:59

1 Answers1

1

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() 
Ishita Shah
  • 3,955
  • 2
  • 27
  • 51