Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/306.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java PhantomJSDriver的Selenium测试已挂起,尚未完成_Java_Junit_Selenium Webdriver_Phantomjs_Ghostdriver - Fatal编程技术网

Java PhantomJSDriver的Selenium测试已挂起,尚未完成

Java PhantomJSDriver的Selenium测试已挂起,尚未完成,java,junit,selenium-webdriver,phantomjs,ghostdriver,Java,Junit,Selenium Webdriver,Phantomjs,Ghostdriver,首先,我启动本地webapp 接下来,当我在Eclipse中作为JUnit测试运行以下测试时(使用-Dbrowser=phantomjs): 考试永远不会结束。就像是挂着一样。(当我在浏览器中打开同一URL时,将显示webapp) 这是控制台输出: Feb 17, 2015 3:28:59 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init> INFO: executable: C:\Users\xx\AppDa

首先,我启动本地webapp

接下来,当我在Eclipse中作为JUnit测试运行以下测试时(使用
-Dbrowser=phantomjs
):

考试永远不会结束。就像是挂着一样。(当我在浏览器中打开同一URL时,将显示webapp)

这是控制台输出:

Feb 17, 2015 3:28:59 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: executable: C:\Users\xx\AppData\Roaming\npm\phantomjs
Feb 17, 2015 3:28:59 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: port: 14234
Feb 17, 2015 3:28:59 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: arguments: [--webdriver=14234, --webdriver-logfile=D:\Test Projects\demoapp-source\web\phantomjsdriver.log]
Feb 17, 2015 3:28:59 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: environment: {}
解决了,只是

1) 更改依赖项():


com.codeborne

)

您可能可以使用npm安装的PhantomJS exe。发生的事情可能是Java无法处理实际启动exe的脚本。正确的,我可以使用控制台中npm中的脚本,但不能使用JUnit测试中的脚本。可能不需要.cmd而需要.exe。@MartinSpa,该工件的代码存储库在哪里?com.codeborne:phantomjsdriver:1.2.1Hi!您可以在Maven Central@MartinSpa中找到它是的,但是该工件的代码存储库在哪里?是否已从原始存储库中分叉它表示代码库仍然为,但实际的代码库是什么,变化是什么?顺便说一下,您可以使用较短的变量,而不是.cssSelector的
$(“#someSelector”)。应该(存在)
Feb 17, 2015 3:28:59 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: executable: C:\Users\xx\AppData\Roaming\npm\phantomjs
Feb 17, 2015 3:28:59 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: port: 14234
Feb 17, 2015 3:28:59 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: arguments: [--webdriver=14234, --webdriver-logfile=D:\Test Projects\demoapp-source\web\phantomjsdriver.log]
Feb 17, 2015 3:28:59 PM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: environment: {}
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.12</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.codeborne</groupId>
  <artifactId>selenide</artifactId>
  <version>2.16</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>com.github.detro</groupId>
  <artifactId>phantomjsdriver</artifactId>
  <version>1.2.0</version>
  <scope>test</scope>
</dependency>
    <dependency>
        <groupId>com.codeborne</groupId>
        <artifactId>phantomjsdriver</artifactId>
        <version>1.2.1</version>
        <scope>test</scope>
    </dependency>