标签: selenium-chromedriver

量角器+镀铬驱动器:元素在点上无法点击

嗨,我在使用基本量角器测试时遇到一些麻烦.

我的设置:

  • 我使用requirejs所以我使用angular.bootstrap()初始角度,而不是ng-app attr.根据量角器文档,这不是开箱即用的支持,但似乎适用于不涉及点击的测试.
  • 量角器conf.json:

    "use strict";
    exports.config = {
        specs: '../E2ETests/**/*.js',
        chromeOnly: true,
        getPageTimeout: 30000,
        allScriptsTimeout: 30000
    }
    
    Run Code Online (Sandbox Code Playgroud)
  • 我使用了一些第三方jquery插件,我将其包装在指令中,我怀疑这些可能是问题的一部分.

考试:

"use strict";
describe('When clicking should add stuff', function () {
    var ptor;
    beforeEach(function () {
        browser.get('https://localhost/myApp');
        ptor = protractor.getInstance();
    });
    it('add stuff', function () {
        // If I comment this, the test pass. 
        element(by.id('add-stuff-button')).click();
        // This does not matter fails on the line above..
        expect(browser.getTitle()).toBeDefined();
    });
});
Run Code Online (Sandbox Code Playgroud)

错误:

UnknownError: unknown error: Element is not clickable at point (720, 881). …
Run Code Online (Sandbox Code Playgroud)

selenium-chromedriver angularjs protractor

32
推荐指数
5
解决办法
4万
查看次数

Selenium Chrome 60无头处理基本认证通过HTTPS进行SAML对话

Chrome 59 删除了对https:// user:password@example.com网址的支持.

我有一个C#selenium测试需要在Windows上以" 无头 "模式使用Chrome版本60

ChromeOptions options = new ChromeOptions();
options.AddArgument("headless");
driver = new ChromeDriver(chrome, options);
Run Code Online (Sandbox Code Playgroud)

这是我试图在Windows上处理的SAML身份验证所需对话框: 基本身份验证对话框

基于这里给出的答案:如何使用Java处理Selenium WebDriver的身份验证弹出窗口我可以看到在FireFox中处理此问题的几种解决方法,但在无头模式下Chrome 60没有.

在访问测试中的URL之前,我尝试使用以下代码访问带有凭据的URL(没有凭据)但是看起来Chrome 60 存在错误.

goTo("http://user:password@localhost"); // Caches auth, but page itself is blocked
goTo("http://localhost"); // Uses cached auth, page renders fine
// Continue test as normal
Run Code Online (Sandbox Code Playgroud)

我可以看到Firefox中的以下代码处理身份验证,对话框永远不会弹出:

FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("network.automatic-ntlm-auth.trusted-uris", "https://saml.domain.com");
profile.EnableNativeEvents = false;`
Run Code Online (Sandbox Code Playgroud)

我试过(第二种方法使用的AutoIt),以及适用于Chrome 60,但确实不是在Chrome 60工作的无头模式.

//Use AutoIt to …
Run Code Online (Sandbox Code Playgroud)

c# basic-authentication selenium-chromedriver selenium-webdriver

32
推荐指数
1
解决办法
2835
查看次数

启动chromedriver时如何修复“[严重]:绑定()失败:无法分配请求的地址(99)”

我在 Centos 7 平台下载了最新版本的 chromedriver:https : //chromedriver.storage.googleapis.com/index.html?path = 74.0.3729.6 /我启动 chromedriver 并收到此错误。

错误 :

Starting ChromeDriver 74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}) on port 9515
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1556179366.141][SEVERE]: bind() failed: Cannot assign requested address (99)
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

在此处输入图片说明

linux selenium-chromedriver

32
推荐指数
4
解决办法
3万
查看次数

如何使用 Selenium 和 Python 绕过 Google CAPTCHA?

如何使用 Selenium 和 Python 绕过 Google CAPTCHA?

当我尝试抓取某些东西时,Google 会给我一个 CAPTCHA。我可以使用 Selenium Python 绕过 Google CAPTCHA 吗?

例如,它是 Google reCAPTCHA。您可以通过此链接查看此 CAPTCHA:https : //www.google.com/recaptcha/api2/demo

python selenium captcha recaptcha selenium-chromedriver

32
推荐指数
2
解决办法
9万
查看次数

Selenium缺失或无效'entry.level'错误

我正在尝试进行硒测试,它应该可以正常工作(没有改变并且习惯了)但我得到了这个奇怪的错误.

System.InvalidOperationException : unknown error: cannot determine loading status
from unknown error: missing or invalid 'entry.level'
  (Session info: chrome=63.0.3239.84)
  (Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 10.0.15063 x86_64)
   at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 1015
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters) in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebDriver.cs:line 849
   at OpenQA.Selenium.Remote.RemoteWebElement.Click() in c:\Projects\WebDriver\trunk\dotnet\src\WebDriver\Remote\RemoteWebElement.cs:line 337
...
Run Code Online (Sandbox Code Playgroud)

什么是"缺少或无效的'entry.level'"错误,我该如何解决?

selenium selenium-chromedriver

31
推荐指数
1
解决办法
3万
查看次数

如何在无头模式下启动ChromeDriver

我想尝试无头镀铬,但我遇到了这个问题,我无法在无头模式下启动驱动程序.我正在关注谷歌文档.我错过了什么吗?该代码执行陷在var browser = new ChromeDriver();线路

这是我的代码:

var chromeOptions = new ChromeOptions
{
    BinaryLocation = @"C:\Users\2-as Aukstas\Documents\Visual Studio 2017\Projects\ChromeTest\ChromeTest\bin\Debug\chromedriver.exe",
    DebuggerAddress = "localhost:9222"
};

chromeOptions.AddArguments(new List<string>() {"headless", "disable-gpu" });

var browser = new ChromeDriver(chromeOptions);


browser.Navigate().GoToUrl("https://stackoverflow.com/");
Console.WriteLine(browser.FindElement(By.CssSelector("#h-top-questions")).Text);
Run Code Online (Sandbox Code Playgroud)

c# selenium selenium-chromedriver

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

硒谷歌登录块

我在使用 Google 登录时遇到问题。我想登录我的帐户,但 Google 说不允许自动化驱动程序登录。

我正在寻找解决方案。是否可以获取普通 Firefox/Chrome 的 cookie 并将其加载到 ChromeDriver/GeckoDriver 中?我认为这可以是一个解决方案。但我不确定这是否可能..

正在寻找解决方案...

在此处输入图片说明

另外,我想添加一个快速解决方案。我通过使用我的旧验证帐户之一解决了这个问题。这对你来说是一个快速的解决方案。

selenium google-chrome selenium-chromedriver selenium-webdriver geckodriver

29
推荐指数
4
解决办法
3万
查看次数

Selenium-chromedriver:无法从不可输入的键构造 KeyEvent

我昨天将 Chrome 和 Chromedriver 更新到了最新版本,从那时起,我在运行 Cucumber 功能时收到以下错误消息:

....
unknown error: Cannot construct KeyEvent from non-typeable key
        (Session info: chrome=98.0.4758.80) (Selenium::WebDriver::Error::UnknownError)
      #0 0x55e9ce6a4093 <unknown>
      #1 0x55e9ce16a648 <unknown>
      #2 0x55e9ce1a9866 <unknown>
      #3 0x55e9ce1cbd29 <unknown>
      .....
Run Code Online (Sandbox Code Playgroud)

我尝试用水豚的fill_in方法填充文本字段。在调试时,我注意到 Capybara 有问题,尤其是符号@\。其他所有字符都可以毫无问题地写入文本字段。

触发错误的代码如下所示

def sign_in(user)
  visit new_sign_in_path
  fill_in 'Email', with: user.email
  fill_in 'Password', with: user.password
  click_button 'Sign in'
end
Run Code Online (Sandbox Code Playgroud)

user.email包含一个类似 的字符串"example1@mail.com"

我使用 Rails 6.1.3.1、Cucumber 5.3.0、Chromedriver 98.0.4758.48、capybara 3.35.3

该错误仅发生在标记为@javascript

您有什么想法导致此错误或如何修复它吗?

ruby-on-rails cucumber capybara selenium-chromedriver

29
推荐指数
1
解决办法
7935
查看次数

selenium.common.exceptions.SessionNotCreatedException:此版本的 ChromeDriver 仅支持 Chrome 版本 114。LATEST_RELEASE_115 不存在

#Once the zip has finished downloading, extract the folder and copy the path of the chromedriver exe file (should be the #first one), add it to your code like this,

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

url = "somewebsite.com"

service_obj = Service("D:\\Users\\eggman\Downloads\chromedriver-win64\chromedriver-win64\chromedriver.exe")
driver = webdriver.Chrome(service=service_obj)
driver.get(url)
Run Code Online (Sandbox Code Playgroud)

返回错误:

selenium.common.exceptions.SessionNotCreatedException:此版本的 ChromeDriver 仅支持 Chrome 版本 114。LATEST_RELEASE_115 不存在

我想为了避免这种情况,我可以关闭自动更新吗?

我最初使用了以下代码,效果很好

driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
Run Code Online (Sandbox Code Playgroud)

python chromium selenium-chromedriver selenium-webdriver

29
推荐指数
2
解决办法
8万
查看次数

Python Selenium Chrome Webdriver

我开始自动化无聊的东西书,我正在尝试通过python打开一个chrome web浏览器.我已经安装了硒和

我试过运行这个文件:

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

browser = webdriver.Chrome()
browser.get('https://automatetheboringstuff.com')
Run Code Online (Sandbox Code Playgroud)

但正因为如此,我得到这个错误:

Traceback (most recent call last):   File "C:\Program Files
   (x86)\Python36-32\lib\site-packages\selenium\webdriver\common\service.py",
 line 74, in start
     stdout=self.log_file, stderr=self.log_file)   File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 707, in __init__
     restore_signals, start_new_session)   File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 990, in _execute_child
     startupinfo) FileNotFoundError: [WinError 2] The system cannot find the file specified
Run Code Online (Sandbox Code Playgroud)

在处理上述异常期间,发生了另一个异常:

Traceback (most recent call last):   File "C:/Program Files
(x86)/Python36-32/test.py", line 5, in <module>
    browser = …
Run Code Online (Sandbox Code Playgroud)

python selenium selenium-chromedriver

28
推荐指数
2
解决办法
9万
查看次数