Python 按…查找并单击元素。。。蟒蛇硒
我正在尝试单击一个元素。在inspect element中,我可以看到:Python 按…查找并单击元素。。。蟒蛇硒,python,web-scraping,beautifulsoup,Python,Web Scraping,Beautifulsoup,我正在尝试单击一个元素。在inspect element中,我可以看到: <a href="/sondc.phtml"><b>S</b>ondeos por territorios</a> 我不知道这是什么意思。我不知道那是不是一个中庭。你能帮我吗?如果你想点击selenium的“Sondeos por territorios”链接,这就可以了 from selenium import webdriver #this path may be d
<a href="/sondc.phtml"><b>S</b>ondeos por territorios</a>
我不知道这是什么意思。我不知道那是不是一个中庭。你能帮我吗?如果你想点击selenium的“Sondeos por territorios”链接,这就可以了
from selenium import webdriver
#this path may be different on your cpu, you need to install a browser driver
driver_loc = r'C:\chromedriver_win32\chromedriver.exe'
url = 'http://www.ogimet.com/'
driver = webdriver.Chrome(driver_loc)
driver.get(url)
the_link = driver.find_element_by_xpath('/html/body/table/tbody/tr[2]/td[1]/div[19]/a')
the_link.click()
您甚至还没有在代码中使用selenium。使用BeautifulSoup,您无法单击任何内容
href
是链接位置:它是您单击链接时着陆的位置
from selenium import webdriver
#this path may be different on your cpu, you need to install a browser driver
driver_loc = r'C:\chromedriver_win32\chromedriver.exe'
url = 'http://www.ogimet.com/'
driver = webdriver.Chrome(driver_loc)
driver.get(url)
the_link = driver.find_element_by_xpath('/html/body/table/tbody/tr[2]/td[1]/div[19]/a')
the_link.click()