HTML
<div id='a'>
<div>
<a class="click">abc</a>
</div>
</div>
You could use the XPATH as :
//div[@id='a']//a[@class="click"]
output
<a class="click">abc</a>
That said your Python code should be as :
driver.find_element_by_xpath("//div[@id='a']//a[@class="click"]")
More Related Contents:
- selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element while trying to click Next button with selenium
- Select iframe using Python + Selenium
- StaleElementException when iterating with Python
- Unable to locate element using selenium chrome webdriver in python selenium
- Python Selenium WebDriver. Writing my own expected condition
- Selenium Compound class names not permitted
- Clicking on svg using selenium python
- Selenium not able to click on Get Data button on using Python
- selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element is not clickable with Selenium and Python
- SyntaxError: Failed to execute ‘evaluate’ on ‘Document’: The string ‘//img[contains(‘1236548597′)]’ is not a valid XPath expression
- Python Selenium – get href value
- ElementClickInterceptedException: Message: element click intercepted: Element is not clickable with Selenium and Python
- ElementNotInteractableException: Message: element not interactable error while sending text to Email field on Quora using Selenium with Python
- How to retrieve partial text from a text node using Selenium and Python
- How to access to ‘rect’ type element through Selenium-Python
- ElementNotInteractableException: Message: element not interactable error sending text in search field using Selenium Python
- selenium two xpath tests in one
- selenium – Failed to execute ‘evaluate’ on ‘Document’: The string is not a valid XPath expression
- How to select kendo dropdown element with unselectable=”on” attribute using Selenium and Python
- How to find element by part of its id name in selenium with python
- “selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element” while clicking a ‘Next’ button with Selenium
- NoSuchElementException: Message: Unable to locate element while trying to click on the button VISA through Selenium and Python
- How to get background-image from inline css using selenium
- How to retrieve the title attribute through Selenium using Python?
- How to click on Load More button within Google Trends and print all the titles through Selenium and Python
- Python 3.5 – “Geckodriver executable needs to be in PATH”
- Python: find_element_by_css_selector
- WebDriverException: Message: Service /content/chromedriver unexpectedly exited. Status code was: -6 with ChromeDriver Google Colab and Selenium
- TypeError: ‘module’ object is not callable error with driver=webdriver(“C:\\Python34\\Lib\\site-packages\\selenium\\webdriver\\chromedriver.exe”)
- Scraping contents of multi web pages of a website using BeautifulSoup and Selenium