我正在尝试打开eBay上的每个列表以进行抓取。我的目标是在“ for循环”中打开每个eBay的列表,这样我就可以抓取每个列表的数据。
不幸的是,我收到一条错误消息:
selenium.common.exceptions.JavascriptException:消息:javascript 错误:链接未定义
我的代码:
driver = webdriver.Chrome('/Users/kenny/Dropbox/Python/Web Scrapping/Others/chromedriver')
driver.get('https://www.ebay.com/sch/i.html?_from=R40&_nkw=watches&_sacat=0&_pgn=1')
soup = BeautifulSoup(driver.page_source, 'lxml')
driver.maximize_window()
for link in soup.find_all('a', href=True):
if 'itm' in link['href']:
print(link['href'])
driver.execute_script("window.open(link['href'])") # Unable to open new tab of each watch to scrape each listing.
整个代码:https://pastebin.com/pFdKU45d
非常感谢。说真的
答案 0 :(得分:1)
引用错误:
*{
"msg": "Jobs listed successfully",
"item": {
"totalPages": 10,
"currentpage": 1,
},
"jobsCount": 10
}*