selenium的那些事--執行報錯

weixin_33912246發表於2019-01-08

1,需要加上3個jar包;

2,報錯資訊:

Please add the directory containing ''firefox.exe'' to your PATH environment
variable, or explicitly specify a path to Firefox 3 like this:
*firefox3c:\blah\firefox.exe
selenium的jira提交bug中心的報告:http://jira.openqa.org/browse/SEL-737
解決方案:http://stackoverflow.com/questions/1344026/how-to-explicitly-specify-a-path-to-firefox-for-selenium
 
這個是selenium的一個bug,最新版本的雖然需要將你需要測試的瀏覽器加入path中,但是卻不檢查。
 
So, I'm guessing you should be able to launch Google Chrome using "*googlechrome" instead of "*chrome".
Google Chrome is not the one which invented the term "chrome", actually ; it meansplenty of things, like Chrome Mozilla or User Interface Chrome
 
 

Chances are this problem is caused by an already-running instance of the Selenium server. The new instance needs to listen on the same port number, but can't, because the port is already in use.

Let's say your Selenium server is configured to start on port 4444. Determine if the port is in use using the 'netstat' command:

On Windows: netstat -an | find "4444"

Expect to see output like this:

  TCP    0.0.0.0:4444           0.0.0.0:0              LISTENING
  TCP    [::]:4444              [::]:0                 LISTENING

On Linux, use: netstat -anp | grep 4444

(No Linux box to hand, so can't show example output!)

If you see any output, you need to kill the process that's listening on the port that Selenium wants to use. On Windows, use netstat -anb to find the process name (it'll be listed after the line specifying the port number). Kill it using the Task Manager. On Linux, the process PID and name will be listed by the command above - kill it using kill -9 <PID>

相關文章