Match All Of A Specific Raw Table With Webdriver Selenium - Python
I'm still new in web scraping and I have this question related to Webdriver. Code Exemple : car Solution 1:
To create a list of all the <tr>
with their child <td>
containing the text bus you can use the following xpath based Locator Strategies:
elements = driver.find_elements_by_xpath("//tr[.//td[contains(., 'bus')]]")
Ideally you need to induce WebDriverWait for the visibility_of_all_elements_located()
and you can use either of the following Locator Strategies:
elements = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, "//tr[.//td[contains(., 'bus')]]")))
Note : You have to add the following imports :
from selenium.webdriver.support.uiimportWebDriverWaitfrom selenium.webdriver.common.byimportByfrom selenium.webdriver.supportimport expected_conditions asEC
Solution 2:
//td[contains(text(),'bus')]
you can use contains text , this gives all td that has bus in it
I'm still new in web scraping and I have this question related to Webdriver. Code Exemple :
car |
Post a Comment for "Match All Of A Specific Raw Table With Webdriver Selenium - Python"