SauceLabs 预运行未按预期工作

问题描述 投票:0回答:0

在我的项目中,我们计划为 VM 实施 SauceLabs 预运行设置,我们也为此创建了一个主机文件,但是当我们将该主机文件传递给可执行对象时,由于预运行问题,它失败了

主机文件

文件名:akamai-host-file(未添加文件扩展名)

@echo off
echo 162.222.75.243 www.google.com > %temp%\temphosts.txt
type C:\WINDOWS\system32\drivers\etc\hosts >> %temp%\temphosts.txt
copy /Y %temp%\temphosts.txt C:\WINDOWS\system32\drivers\etc\hosts

添加到 selenium 中的 Chrome 功能

JSONObject obj = new JSONObject();
obj.put("executable","path to akamai host file");
LinkedList<String> list = new LinkedList<String>();
list.add("/S");
list.add("-a");
list.add("-q");
obj.put("args",list);
obj.put("background","false");
obj.put("timeout", "240");
capability.setCapability("prerun",obj);
WebDriver driver=new RemoteWebdriver(new URL(URL), capabilities);

异常

Capabilities {browserName: chrome, dom.disable_window_open_feature.menubar: true, idleTimeout: 90, name: Feature: RR-121_Validate Us..., network.http.pipelining: true, network.http.pipelining.maxrequests: 8, network.http.proxy.pipelining: true, platform: WIN10, prerun: {args: [/S, -a, -q], background: false, executable: automated-tes..., timeout: 240}, screenResolution: 1920x1080, tags: Automated-Tests, version: 90}

org.openqa.selenium.WebDriverException: Unable to parse remote response: automated-tests\src\test\resources\akamai_host_file is not available. Make sure the file is in App Storage and you have access permissions to it before retrying. If you have confirmed you have access to the file in App Storage and you continue to get this error, contact [email protected] for support.
org.openqa.selenium.WebDriverException: Sauce could not start your job. For more information on what happened, please visit https://app.saucelabs.com/tests/f8ef397c06464a2db70fc6b4c0541397 (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 16.29 seconds
Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
System info: host: 'Hostnamr', ip: 'IP Address'', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_275'
Driver info: driver.version: RemoteWebDriver

由于 SauceLabs 预运行,脚本在初始化浏览器时失败。有人可以帮我解决这个问题吗?

java windows selenium-webdriver saucelabs selenium4
© www.soinside.com 2019 - 2024. All rights reserved.