如何更改Firefox WebDriver端口

编程入门 行业动态 更新时间:2024-10-25 01:30:25
本文介绍了如何更改Firefox WebDriver端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

好奇的是,如何在不同的端口(例如IE和Chrome驱动程序)上运行firefox驱动程序.该驱动程序具有类似的选项

It is just a curiosity that how can I run firefox driver on different port like IE and Chrome driver.This driver have option like

ChromeDriverService service=new ChromeDriverService.Builder().usingPort(7000). usingDriverExecutable(new File("")).build();

尽管firefox驱动程序具有类似的选项

though the firefox driver have the option like that

System.setProperty("webdriver.firefox.port","7046");

DesiredCapabilities cap=new DesiredCapabilities(); cap.setCapability("webdriver_firefox_port",7046);

但是它不能在此端口上运行firefox驱动程序,我正在使用2.41 Selenium Webdriver和firefox 31

but it can not run firefox driver on this port I am using 2.41 Selenium Webdriver and firefox 31

任何人都可以解释为什么以及如何在指定端口中运行firefox驱动程序.

Can anyone explain why and how can I run firefox driver in specified port.

推荐答案

好吧,不确定,但这应该可以工作

Well, not sure, but this should work

ProfilesIni allProfiles = new ProfilesIni(); FirefoxProfile profile = allProfiles.getProfile("WebDriver"); profile.setPreference(FirefoxProfile.PORT_PREFERENCE, 7046) WebDriver driver = new FirefoxDriver(profile);

更多推荐

如何更改Firefox WebDriver端口

本文发布于:2023-08-07 19:43:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1321393.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:端口   如何更改   Firefox   WebDriver

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!