如何在 Scrapy Selenium 中使用带头的 chrome 驱动程序 [英] How to use chrome driver with head in Scrapy Selenium
问题描述
我正在使用带有scrapySelenium的Scrapy,但是scrapy selenium从无头浏览器开始,但出于某种目的,我需要从头开始,以便我可以继续查看我的scrapy在浏览器中的作用如何关闭在设置中传递的无头参数的scrapy
I Am using Scrapy with scrapySelenium but the scrapy selenium starts with a headless browser but for some purpose i need to start it with head so i can keep seeing what my scrapy does in the browser how to turn off headless arguments passed in settings of scrapy
这是我在设置中复制的内容,如您所见,它是无头的,但无论如何都希望看到使用 Scrapy Selenium 打开的浏览器从shutil进口
this is what i copied in the settings it is headless as you can see but want to see the browser open up with Scrapy Selenium is there anyway from shutil import which
SELENIUM_DRIVER_NAME = '铬'SELENIUM_DRIVER_EXECUTABLE_PATH = which('chromedriver')SELENIUM_DRIVER_ARGUMENTS=['-headles'] # '--headless' 如果使用 chrome 而不是 firefox
SELENIUM_DRIVER_NAME = 'chrome' SELENIUM_DRIVER_EXECUTABLE_PATH = which('chromedriver') SELENIUM_DRIVER_ARGUMENTS=['-headles'] # '--headless' if using chrome instead of firefox
推荐答案
从 settings.py 中删除 SELENIUM_DRIVER_ARGUMENTS = ['--headless']
.
Delete the SELENIUM_DRIVER_ARGUMENTS = ['--headless']
from the settings.py.
使用 selenium webdriver,你可以传递参数,这个参数确保它是一个无头浏览器.
With selenium webdriver you can pass arguments and this argument makes sure that it is a headless browser.
这篇关于如何在 Scrapy Selenium 中使用带头的 chrome 驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!