我将单击红色圆圈中的那个按钮。
我想抓取那个网站。我如何编写python代码?
我试过这段代码
from bs4 import BeautifulSoup
from urllib.request import urlopen
import time
from selenium import webdriver
driver = webdriver.Chrome('./chromedriver.exe')
url_base = 'https://www.kebhana.com/cont/mall/mall08/mall0805/index.jsp?_menuNo=62608'
driver.implicitly_wait(5)
driver.get(url_base)
openElement = driver.findElement(By.linkText("li[2]")).click();
time.sleep(2)
openElement.click()
time.sleep(5)
driver.quit()
soup
错误消息显示如下:
AttributeError Traceback (most recent call last)
<ipython-input-16-19b58965022a> in <module>()
8
9 driver.get(url_base)
---> 10 openElement = driver.findElement(By.linkText("li[2]")).click();
11
12
AttributeError: 'WebDriver' object has no attribute 'findElement'
该按钮的html代码是
<li class="on">
<a href="#none" onclick="javascript:doTab('spb_2812');">
<span>적 금</span>
</a>
</li>
翻阅古今
牛魔王的故事
千巷猫影
相关分类