1

Sample code:

score_both_halves = driver.find_element_by_xpath('//label[@data-btn-radio="\'ScoreBothHalves\'"]')
score_both_halves.find_element_by_xpath() 

In the second line of code I used a find_element_by_xpath() method of Webdriver class with WebElement object and it works fine.

How is that possible? Is WebElement class inherits from WebDriver class in selenium python?

Isn't the WebElement class inherits from WebDriver class in selenium python? If not then how we can use methods of WebDriver class with WebElement object?

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
Ali Haider
  • 25
  • 4

1 Answers1

1

As per the Selenium Python binding documentation:


Conclusion

Hence driver.find_element(By.ID, 'foo') and element.find_element(By.ID, 'foo') both are valid lies of code.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352