我拥有最新的Selenium,OSX和Safari版本,但无法使用如下所示的简单代码打开Safari驱动程序:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.safari.SafariDriver;
public class SafariDriverDemo {
public static void main(String[] args) throws InterruptedException {
WebDriver driver;
driver = new SafariDriver();
String baseURL = "https://www.google.com";
driver.get(baseURL);
Thread.sleep(3000);
driver.quit();
}
}
我在控制台中得到的是以下内容:“ Password:Password:Password:”
并且无论我输入什么密码,控制台都会显示:Screenshot 2
尽管我启用了“允许远程自动化”。我尝试通过键入'/ usr / bin / safaridriver'从终端授权驱动程序,这是结果
Could not start server: must specify at least one configuration argument.
Usage: safaridriver [options]
-h, --help Prints out this usage information.
-p, --port Port number the driver should use. If the server
is already running, the port cannot be changed.
If port 0 is specified, a default port will be used
我不知道从这里采取什么措施,也许可以从控制台解决该问题。
最佳答案
尝试运行/usr/bin/safaridriver -p 0
关于java - Selenium :SafariDriver无法在MacOS Sierra中打开,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43780709/