尝试通过打开浏览器来编写简单的自动化脚本以导航到链接
使用Chrome
它抛出Failed:使用browser.get(link)
时参数无效我认为问题出在驱动程序版本
所以Treid更新了webdriver-manager以及chrome,但没有用
下面是使用的配置文件和错误
更改了文件名,名称没有冲突 假设它们在任何地方都一样
specsFile
describe('Affiliate', function() {
browser.ignoreSynchronization = true;
browser.waitForAngularEnabled(false);
it('Convert to links', function(){
browser.get('https://www.google.com/');
})
});
specfile中没有太多内容
Config File
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
browserName: 'chrome',
chromeOptions: {
binary: '/usr/bin/google-chrome-stable',
args: ["--disable-notifications","--disable-gpu", "--window-size=800,600", "--no-sandbox" ]
}
},
specs: ['../Scripts/specsFile.spec.js'],
jasmineNodeOpts: {
showColors: true,
}
};
错误
[02:51:35] I/launcher - Running 1 instances of WebDriver
[02:51:35] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
Started
.F
Failures:
1) sample
Message:
Failed: invalid argument
(Session info: chrome=77.0.3865.90)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'hey', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.0.0-29-generic', java.version: '1.8.0_201'
Driver info: driver.version: unknown
Stack:
WebDriverError: invalid argument
(Session info: chrome=77.0.3865.90)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'hey', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '5.0.0-29-generic', java.version: '1.8.0_201'
Driver info: driver.version: unknown
at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:546:15)
at parseHttpResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:509:13)
at doSend.then.response (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:441:30)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
From: Task: WebDriver.navigate().to()
at thenableWebDriverProxy.schedule (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:807:17)
at Navigation.to (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:1133:25)
at thenableWebDriverProxy.get (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver.js:988:28)
at ProtractorBrowser.get (/usr/local/lib/node_modules/protractor/built/browser.js:655:32)
at UserContext.<anonymous> (/home/hey/NodeJsWorkSpace/Scripts/specsFile.spec.js:13:17)
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:112:25
at new ManagedPromise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1077:7)
at ControlFlow.promise (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2505:12)
at schedulerExecute (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:95:18)
at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:3084:14)
From: Task: Run it("Convert to links") in control flow
at UserContext.<anonymous> (/usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:94:19)
From asynchronous test:
Error
at Suite.<anonymous> (/home/hey/NodeJsWorkSpace/Scripts/specsFile.spec.js:11:5)
at Object.<anonymous> (/home/hey/NodeJsWorkSpace/Scripts/specsFile.spec.js:1:63)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
2 specs, 1 failure
Finished in 0.174 seconds
[02:51:36] I/launcher - 0 instance(s) of WebDriver still running
[02:51:36] I/launcher - firefox #01 failed 1 test(s)
[02:51:36] I/launcher - overall: 1 failed spec(s)
[02:51:36] E/launcher - Process exited with error code 1