gpt4 book ai didi

java - 如何在没有 ChromeDriver.exe 的情况下从 Selenium Remote Webdriver 启动 Google Chrome

转载 作者:行者123 更新时间:2023-12-04 10:55:11 25 4
gpt4 key购买 nike

我想在不使用 ChromeDriver.exe 的情况下在服务器上启动谷歌浏览器
目前正在尝试使用 RemoteWebDriver ,但出现以下错误

我正在尝试的代码:

public class DEMO {
public static void main(String[] args) throws MalformedURLException {
// create a Chrome Web Driver
URL local = new URL("http://localhost:8080");
WebDriver driver = new RemoteWebDriver(local, DesiredCapabilities.chrome());
// open the browser and go to open google.com
driver.get("https://www.google.com");


driver.manage().window().maximize();
}

错误 :
Exception in thread "main" org.openqa.selenium.UnsupportedCommandException: <html><head><title>Apache Tomcat/7.0.47 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /session</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/session</u></p><p><b>description</b> <u>The requested resource is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.47</h3></body></html>
Command duration or timeout: 333 milliseconds
Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 17:01:03'

最佳答案

Chrome 的任何操作最终都应通过 chromedriver(Windows 操作系统的 .exe)传递。这是 Selenium/WebDriver 的基本概念。是远程调用还是本地调用。

关于java - 如何在没有 ChromeDriver.exe 的情况下从 Selenium Remote Webdriver 启动 Google Chrome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59247631/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com