我在使用seleniumpython3.6收集元组数据时遇到了一个问题。这是我要收集数据的页面(http://www.bobaedream.co.kr/cyber/CyberCar.php?gubun=I) 我想收集“制造商(制造商)”的数据在搜索菜单在页面的上部。在
我使用selenium webdrive设置虚拟页面,并使用以下代码收集和选择第一个下拉菜单的列表:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from bs4 import BeautifulSoup
from time import sleep
link = 'http://www.bobaedream.co.kr/cyber/CyberCar.php?gubun=I'
driver = webdriver.PhantomJS()
driver.set_window_size(1920, 1080)
driver.get(link)
sleep(.75)
soup = BeautifulSoup(driver.page_source, "html.parser", from_encoding='utf-8')
manufacturers = [
('%s', '%s') % (o.text, o.get_attribute('href'))
for o
in driver.find_elements_by_css_selector("#layer_maker ul.list li a")
if o.text != '전체']
for manufacturer in manufacturers:
driver.execute_script("o.get_attribute('href')")
这是我收到的错误信息:
^{pr2}$请帮忙。在
我想这就是你需要的:
或者只是
^{pr2}$注意,
%
也是Python
中的一个“模”运算符,不能应用于元组相关问题 更多 >
编程相关推荐