相关疑难解决方法(0)

是否有无法检测到的 Selenium WebDriver 版本?

我在住宅代理网络后面的Ubuntu服务器上通过 Selenium 运行 Chrome 驱动程序。然而,我的硒正在被检测到。有没有办法让 Chrome 驱动程序和 Selenium 100% 无法检测?

我已经尝试了很长时间,但我忘记了我所做的许多事情,包括:

  1. 尝试不同版本的 Chrome
  2. 添加几个标志并从 Chrome 驱动程序文件中删除一些词。
  3. 使用隐身模式在代理(住宅代理)后面运行它。
  4. 加载配置文件。
  5. 随机鼠标移动。
  6. 随机化一切。

我正在寻找 100% 无法检测到的真正 Selenium 版本。如果那曾经存在过。或者机器人跟踪器无法检测到的另一种自动化方式。

这是浏览器启动的一部分:

sx = random.randint(1000, 1500)
sn = random.randint(3000, 4500)

display = Display(visible=0, size=(sx,sn))
display.start()


randagent = random.randint(0,len(useragents_desktop)-1)

uag = useragents_desktop[randagent]
#this is to prevent ip leaking
preferences =
    "webrtc.ip_handling_policy" : "disable_non_proxied_udp",
    "webrtc.multiple_routes_enabled": False,
    "webrtc.nonproxied_udp_enabled" : False

chrome_options.add_experimental_option("prefs", preferences)
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-impl-side-painting")
chrome_options.add_argument("--disable-setuid-sandbox")
chrome_options.add_argument("--disable-seccomp-filter-sandbox")
chrome_options.add_argument("--disable-breakpad")
chrome_options.add_argument("--disable-client-side-phishing-detection")
chrome_options.add_argument("--disable-cast")
chrome_options.add_argument("--disable-cast-streaming-hw-encoding")
chrome_options.add_argument("--disable-cloud-import")
chrome_options.add_argument("--disable-popup-blocking")
chrome_options.add_argument("--ignore-certificate-errors")
chrome_options.add_argument("--disable-session-crashed-bubble")
chrome_options.add_argument("--disable-ipv6")
chrome_options.add_argument("--allow-http-screen-capture") …
Run Code Online (Sandbox Code Playgroud)

selenium google-chrome webdriver selenium-chromedriver selenium-webdriver

20
推荐指数
2
解决办法
3万
查看次数

selenium.common.exceptions.WebDriverException:消息:无效的会话 id 使用 Selenium 与 ChromeDriver 和 Chrome 通过 Python

我正在使用 Selenium 编写一些代码,并且有一次我向不同的网站发出了 7 个请求。对于第一个,这很好用。但是,对于其他人,我收到会话 ID 错误。我认为我的浏览器配置正确,因为我确实从第一个网站获得了结果。我试图在请求之间放置一个 WebDriverWait,但无济于事。我认为这些网站可能会阻止我的请求。有谁知道如何解决这个问题?

如果这是愚蠢的事情或者我做错了什么,我很抱歉,我很新^^

提前致谢!

Traceback (most recent call last):
  File "/home/cena/PycharmProjects/Frikandelbroodje/main.py", line 56, in <module>
    dirk_price = get_price(dirk_url, dirk_classname)
  File "/home/cena/PycharmProjects/Frikandelbroodje/main.py", line 44, in get_price
    browser.get(url)
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: invalid session id
  (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 4.15.0-50-generic x86_64)
Run Code Online (Sandbox Code Playgroud)

python selenium google-chrome webdriver selenium-chromedriver

15
推荐指数
2
解决办法
3万
查看次数

无法使用Selenium自动化Chase站点登录

当我尝试使用Selenium(Python)登录Chase网站时,我遇到以下错误消息:

追逐登录失败图像

但是,使用"人"登录工作正常.似乎当Selenium找到一个元素时会引发问题.

我错过了什么吗?我试图在stackoverflow上找到答案,但无济于事.

更新:

预期的结果是脚本将成功允许我以编程方式登录.

这是下面的代码示例:

import time
import os

from selenium import webdriver

CHASE_USER_ID = os.getenv('CHASE_USER_ID', None)
CHASE_PASSWORD = os.getenv('CHASE_PASSWORD', None)

assert CHASE_USER_ID is not None, 'Chase user id not set'
assert CHASE_PASSWORD is not None, ' Chase password not set'


def main():
    chrome_options = webdriver.ChromeOptions()
    driver = webdriver.Chrome(r'./chromedriver', chrome_options=chrome_options)

    try:
        driver.get('https://secure07c.chase.com/web/auth/#/logon/logon/chaseOnline?')

        time.sleep(2)

        user_element = driver.find_element_by_id('userId-input-field')  # Finding an element here seems to make the login process fail 
        user_element.send_keys(CHASE_USER_ID)

        password_element = driver.find_element_by_id('password-input-field')
        password_element.send_keys(CHASE_PASSWORD)

        time.sleep(2)

        password_element.submit()

        time.sleep(10)
    finally:
        driver.quit()


if …
Run Code Online (Sandbox Code Playgroud)

python selenium google-chrome webdriver selenium-chromedriver

13
推荐指数
1
解决办法
1836
查看次数

Selenium webdriver:修改navigator.webdriver标志以防止硒检测

我正在尝试使用selenium和chrome在网站中自动执行一项非常基本的任务,但不知何故,网站检测到chrome由硒驱动并阻止每个请求.我怀疑该网站依赖于一个暴露的DOM变量,如/sf/answers/2933311741/来检测selenium驱动的浏览器.

我的问题是,有没有办法让navigator.webdriver标志为假?我愿意在修改之后尝试重新编译硒源,但我似乎无法在存储库中的任何地方找到NavigatorAutomationInformation源https://github.com/SeleniumHQ/selenium

任何帮助深表感谢

PS:我还从https://w3c.github.io/webdriver/#interface尝试了以下内容

Object.defineProperty(navigator, 'webdriver', {
    get: () => false,
  });
Run Code Online (Sandbox Code Playgroud)

但它只在初始页面加载后更新属性.我认为该网站在我的脚本执行之前检测到该变量.

java selenium webdriver selenium-webdriver webdriver-w3c-spec

10
推荐指数
9
解决办法
5531
查看次数

抱歉,在使用 Selenium 的自动化测试环境中加载 Google API 时,您的计算机或网络可能会发送自动查询错误

我有一个使用 Google API JS 客户端的单页应用程序。

该应用程序还有一个用 Java 和 Selenium 编写的自动化功能测试套件,每次构建应用程序时都会在测试环境中运行。测试套件生成多个浏览器,这些浏览器或多或少同时单击应用程序的多个流程。

这通常会导致 Google 针对以下文件返回 HTTP 403:

<script src="https://apis.google.com/js/api.js"></script>
Run Code Online (Sandbox Code Playgroud)

附加信息:

很抱歉,您的计算机或网络可能正在发送自动查询。为了保护我们的用户,我们现在无法处理您的请求。

我尝试研究 Google API 配额,但它们似乎只影响实际的 API 调用,而不影响客户端库本身。

有人遇到过类似的问题吗?我们可以检测到这种情况并重试失败的测试,但这会导致对 apis.google.com 的更多调用,并使测试速度非常慢。也很难确定测试时间的增加是因为应用程序的更改还是因为 GAPI 客户端库加载失败。

selenium selenium-webdriver google-api-js-client

8
推荐指数
1
解决办法
4万
查看次数

Recaptcha 3如何知道我正在使用硒/ chromedriver?

我很好奇Recaptcha v3的工作方式。特别是浏览器指纹。

当我通过selenium / chromedriver启动chrome实例并针对ReCaptcha 3(https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php)进行测试时,使用selenium /时我总是得到0.1分chromedriver。

在正常实例中使用隐身模式时,我得到0.3。

我通过注入JS并修改Web驱动程序对象并从源代码重新编译WebDriver并修改$ cdc_变量来击败其他检测系统。

我可以看到看起来有些混乱的POST返回到服务器,所以我将开始在那里进行挖掘。

我只是想检查是否有人愿意首先与它分享任何建议或经验,以决定我是否正在运行Selenium / chromedriver?

selenium recaptcha web-scraping selenium-chromedriver recaptcha-v3

7
推荐指数
2
解决办法
7068
查看次数