How to find an element with respect to the user input using Selenium and Python?

前端 未结 2 1001
天命终不由人
天命终不由人 2021-01-23 11:15

The following is the HTML structure:

12345

abc

2条回答
  •  -上瘾入骨i
    2021-01-23 11:56

    Try the below xpath:

    code = '23456'
    element = driver.find_element_by_xpath("//p[@class='code' and text()='" +code +"']")
    

提交回复
热议问题