擅长:python、mysql、java
<p>尝试使用<em>完整XPath</em>:</p>
<p>我正在使用Firefox web驱动程序(您可以从<a href="https://pycheat.com/download_img.php" rel="nofollow noreferrer">here</a>下载):</p>
<pre><code>from selenium import webdriver
site = 'https://www.gv.com.sg/GVMovies'
#providing driver path
driver = webdriver.Firefox(executable_path = 'C:\Drivers\geckodriver.exe')
driver.get(site)
try:
driver.find_element_by_xpath("/html/body/div[3]/div[2]/div/div/div[2]/div/ul/li[2]/a").click()
except Exception as e:
pass
</code></pre>