selenium 2.53.1 download path, selenium-java-2.53.1.zip, decompression,
open eclipse,new a java project, create a new folder named 'lib',
copy all .jar file from the decompression folder to lib folder,
select all .jar file in eclipse, right click, click Build Path, click Add to Build Path, then it will generate a new Referenced Libraries folder. then those .jar will be used when u run your software project.
eclipse auto-complete main method,Alt+/, enter.
eclipse 错误: 找不到或无法加载主类
解决:在project菜单下边勾上Build Automaticlly,然后运行,就好了。
elipse中菜单project—clear然后选中对应项目,在project菜单下边勾上Build Automaticlly(自动部署),然后生成新的就class文件就OK了。
eclipse字体大小怎么设置
步骤一:打开eclipse,找到“window”--“preferences”,在左边的菜单栏中找到general,appearance在general展开后的第一行,点击展开appearance;

步骤二:找到“colors and fonts”,点击;
- selenium docs
Write your first Selenium script | Selenium
导包 快捷键 Ctrl+Shift+o
firefox error
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
console.warn: TopSitesFeed: Failed to fetch data from Contile server: NetworkError when attempting to fetch resource.
###!!! [Child][PContentChild] Error: Send(msgname=PContent::Msg_AsyncMessage) Channel closing: too late to send/recv, messages will be lost
at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:119)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:218)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:211)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:207)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at com.lemon.auto.FirefoxTester.main(FirefoxTester.java:10)
Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(D:\Program Files (x86)\Mozilla Firefox\firefox.exe) on port 7055; process output follows:
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
console.warn: TopSitesFeed: Failed to fetch data from Contile server: NetworkError when attempting to fetch resource.
###!!! [Child][PContentChild] Error: Send(msgname=PContent::Msg_AsyncMessage) Channel closing: too late to send/recv, messages will be lost

错误原因:firefox安装在其他路径,不是默认安装路径
解决办法:指定Firefox可执行文件路径:webdriver.firefox.bin
或者:SystemProperty.BROWSER_BINARY
设置: System.setProperty("webdriver.firefox.bin", "D:\Program Files (x86)\Mozilla Firefox\firefox.exe"); //java中\是转义字符 \表示\
设置后运行报错:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
###!!! [Child][PContentChild] Error: RunMessage(msgname=PContent::Msg_AsyncMessage) Channel closing: too late to send/recv, messages will be lost
console.warn: TopSitesFeed: Failed to fetch data from Contile server: NetworkError when attempting to fetch resource.
原因是Firefox版本太新和selenium的版本2.53.1不对,解决方法:重新安装Firefox,用46.0版本(Firefox(火狐浏览器) Beta8官方正式版v46.0)。
版权归原作者 ALtimeAshes 所有, 如有侵权,请联系我们删除。