特定站点不使用 Selenium (python) 呈现

     2023-03-24     176

关键词:

【中文标题】特定站点不使用 Selenium (python) 呈现【英文标题】:Specific sites doesn't render using Selenium (python) 【发布时间】:2022-01-21 16:24:04 【问题描述】:

我一直在 Chrome 和 Firefox 上使用 selenium 和 python。当我尝试使用 selenium 运行该特定网站时,这两个浏览器上的特定网站都保持空白 - 我将不胜感激。这是我的 chrome 代码:

from selenium import webdriver
    options = webdriver.ChromeOptions()
    options.add_experimental_option("useAutomationExtension", False)
    options.add_experimental_option("excludeSwitches",["enable-automation"])
    
    path = r'C:\Program Files (x86)\chromedriver.exe'
    driver = webdriver.Chrome(executable_path=path, chrome_options=options)
    
    driver.get('https://main.knesset.gov.il/Activity/committees/pages/allcommitteesagenda.aspx')

【问题讨论】:

一些页面被保护以防被抓取 【参考方案1】:

添加参数--disable-blink-features=AutomationControlled

代码块:

options = Options()
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_argument('--disable-blink-features=AutomationControlled')
driver = webdriver.Chrome(executable_path=r'C:\BrowserDrivers\chromedriver.exe', options=options)
driver.get("https://main.knesset.gov.il/Activity/committees/pages/allcommitteesagenda.aspx")

浏览器快照:


参考文献

您可以在以下位置找到一些相关的详细讨论:

How to evade blocking by Walmart using Selenium Webdriver Selenium can't open a second page

【讨论】:

如何在使用 Selenium 和 Python 调用函数之前等待特定 URL 加载

】如何在使用Selenium和Python调用函数之前等待特定URL加载【英文标题】:HowtowaitforaspecificURLtoloadbeforecallingafunctionusingSeleniumandPython【发布时间】:2020-05-0102:48:36【问题描述】:这是我第一次在***上发帖,我对Selenium和Python还有些陌... 查看详情

如何识别 ReCaptcha V2 的 32 位数据站点密钥以使用 Selenium 和 Python 请求以编程方式获取有效响应?

】如何识别ReCaptchaV2的32位数据站点密钥以使用Selenium和Python请求以编程方式获取有效响应?【英文标题】:Howtoidentifythe32bitdata-sitekeyofReCaptchaV2toobtainavalidresponseprogrammaticallyusingSeleniumandPythonRequests?【发布时间】:2020-05-2519:01:29【... 查看详情

Selenium web 自动化使用 python:如何使用 selenium 处理表以通过匹配文本来查找特定行并删除该行

】Seleniumweb自动化使用python:如何使用selenium处理表以通过匹配文本来查找特定行并删除该行【英文标题】:Seleniumwebautomationusingpython:HowcanIhandletableusingseleniumtofindaparticularrowbymatchingtextanddeletethatrow【发布时间】:2021-12-3019:29:13【... 查看详情

如果站点使用 Ajax,如何检查 Selenium WebDriver?

】如果站点使用Ajax,如何检查SeleniumWebDriver?【英文标题】:HowtocheckwithSeleniumWebDriverifasiteisusingAjax?【发布时间】:2015-07-2709:24:16【问题描述】:我正在一些未知的第三方网站上进行研究和开发,以使用selenium获取页面内容。我... 查看详情

如何使用 selenium python 查找包含特定字符串的所有按钮?

】如何使用seleniumpython查找包含特定字符串的所有按钮?【英文标题】:Howtofindallbuttonswhichcontainsaspecificstringusingseleniumpython?【发布时间】:2022-01-2221:08:53【问题描述】:我想查找页面上所有包含单词“card”或单词“bag”的按钮... 查看详情

如何使用 selenium java/python 确定元素是不是在特定时间显示在屏幕上?

】如何使用seleniumjava/python确定元素是不是在特定时间显示在屏幕上?【英文标题】:Howtodetermineifanelementisdisplayedonscreenforspecifictimeusingseleniumjava/python?如何使用seleniumjava/python确定元素是否在特定时间显示在屏幕上?【发布时间】... 查看详情

如何使用 python 将 cookie 设置为 selenium webdriver 中的特定域?

】如何使用python将cookie设置为seleniumwebdriver中的特定域?【英文标题】:Howtosetacookietoaspecificdomaininseleniumwebdriverwithpython?【发布时间】:2014-09-1504:06:25【问题描述】:您好***用户。我想要实现的是防止在我的测试打开主页时弹出... 查看详情

如何使用 Selenium 和 Python 在元素中查找元素?

】如何使用Selenium和Python在元素中查找元素?【英文标题】:HowdoIfindelementsinsideofelementsusingSeleniumwithPython?【发布时间】:2020-02-1211:26:55【问题描述】:我不知道返回这个HTML示例中特定元素的语法。<divclass="calibre"id="calibre_link-0"... 查看详情

Selenium 使用 Python:输入/提供 Firefox 的 http 代理密码

】Selenium使用Python:输入/提供Firefox的http代理密码【英文标题】:SeleniumusingPython:enter/providehttpproxypasswordforfirefox【发布时间】:2012-02-1116:43:27【问题描述】:我想将selenium与受密码保护的代理一起使用。代理不是固定的,而是一... 查看详情

访问被拒绝您无权访问 Selenium Python 中的站点 [重复]

】访问被拒绝您无权访问SeleniumPython中的站点[重复]【英文标题】:AccessDeniedYoudon\'thavepermissiontoaccesssiteinSeleniumPython[duplicate]【发布时间】:2022-01-1819:57:18【问题描述】:这是我的Python代码,在重新加载webdriver时运行此代码后,我... 查看详情

使用 selenium 添加 cookie 时,站点中断

】使用selenium添加cookie时,站点中断【英文标题】:Whenaddingcookieswithselenium,sitebreaks【发布时间】:2021-10-2209:25:12【问题描述】:在处理selenium时,我发现我的脚本做了一些奇怪的事情。roblox网站运行良好,直到我添加了一个cookie... 查看详情

使用 python 抓取具有无限滚动的站点

...好方法无限滚动。在四处挖掘之后,我发现有一个包调用selenium并且它有python模块。我有一种感 查看详情

Selenium 程序执行不使用 Python 类开始

】Selenium程序执行不使用Python类开始【英文标题】:SeleniumprogramexecutiondoesnotstartusingPythonClass【发布时间】:2021-12-1819:21:48【问题描述】:这里是代码classInstogramBot():def__init__(self,username,password):self.username=usernameself.password=passwor 查看详情

在 Python 中使用 Selenium 浏览链接 [重复]

】在Python中使用Selenium浏览链接[重复]【英文标题】:NavigatingthroughlinksusingSeleniuminPython[duplicate]【发布时间】:2019-07-1517:21:24【问题描述】:我正在尝试从具有多个通过NEXT按钮链接的页面的站点中抓取数据后续页面URL与之前的页... 查看详情

python+selenium(chrome):如何从当前网址中提取特定文本并使用提取的文本转到另一个文本?(代码片段)

我一直在使用iMacros,我有一个代码,我可以提取文本并使用它来创建我需要的特定网址。它是这样的:#IcanextracttheXPathtextwiththis.TAGXPATH="//*[@id="meio"]/div[2]/section/article[5]/h2/span/a"EXTRACT=TXT#Withthis,I'mabletousethatextractedtexttogot 查看详情

使用 Selenium 和 Python 选择选项

】使用Selenium和Python选择选项【英文标题】:SelectingoptionsusingSeleniumandPython【发布时间】:2021-12-2723:16:21【问题描述】:我知道有几个selenium选项选择的例子。尽管如此,我仍然无法选择一个特定的网站。https://www.gks.ru/dbscripts/muns... 查看详情

如何使用 Selenium WebDriver 和 Java 滚动特定的 DIV?

】如何使用SeleniumWebDriver和Java滚动特定的DIV?【英文标题】:HowtoscrollaspecificDIVusingSeleniumWebDriverwithJava?【发布时间】:2015-01-2703:27:16【问题描述】:WebDriver无法识别某些WebElements,WebDriver无法找到浏览器可见区域中不可见的元素... 查看详情

单击 div 包含带有 selenium python 的特定文本

】单击div包含带有seleniumpython的特定文本【英文标题】:clickondivcontainsspecifictextwithseleniumpython【发布时间】:2022-01-0208:03:37【问题描述】:我刚开始学习python一周,希望我们selenium点击包含来自两个不同元素的特定文本的div容器... 查看详情