How to search a webpage using selenium by any of the keywords inputted?

后端 未结 2 1465
我寻月下人不归
我寻月下人不归 2021-01-26 21:48

I am new to selenium in python. I am searching the supreme website by keywords using Xpath as such:

WebDriverWait(driver, 5).until(EC.element_to_be_clickable(
           


        
相关标签:
2条回答
  • 2021-01-26 22:17

    can you try this xpath:

     //a[contains(text(),'Dragon Tee')] /parent::div/following-sibling::*/a[contains(text(),'Dusty')]
    
    0 讨论(0)
  • 2021-01-26 22:23

    You can use XPath to solve this by looking for sibling tags. For example, if you want to find the Dragon Tee Heather Grey link, you can use this.

    driver.find_element_by_xpath('//div[a/text() = "Dragon Tee"]/following-sibling::div[a/text() = "Heather Grey"]')
    
    0 讨论(0)
提交回复
热议问题