我使用无头panthom浏览器使用phantomjs驱动程序与selenium自动化应用程序.(selenium java version 3.5.2和phantomjs.exe)
我有一个场景,我将填写表格并提交它,然后浏览器关闭,关闭浏览器后,我重新使用驱动程序引用来获取URL.当我使用带有selenium 2.47.0的firefox驱动程序时,它运行良好.
现在我切换到selenium phontamjsdriver和phantombrowser.这里当我调用driver.get(url);在浏览器关闭后,它抛出nosuchwindowexception,说窗口关闭或不活动.但是,相同的代码正在使用firefox驱动程序
例:
driver.get(url);// first time works
submitForm(driver);//browser window gets closed.
driver.get(url);
Run Code Online (Sandbox Code Playgroud)
最后一行是抛出异常:
nosuchwindowexception(selenium java with 3.5.2 version and phantomjs.exe).
Run Code Online (Sandbox Code Playgroud)
但与firefoxbrowser与selenium 2.4.7配合得很好.
我遇到过一种情况,我从 Angular 6 应用程序调用 Spring Boot 应用程序。当我以与在不同端口上运行的应用程序的角度调用 HTTP post 方法时,它会引发异常。
从源“ http://localhost: 4200 ”访问位于“http://localhost:8080/api”的XMLHttpRequest已被 CORS 策略阻止:对预检请求的响应未通过访问控制检查:它没有 HTTP好的状态。
我的 Angular 应用程序在“ http://localhost:4200 ”上运行,端口号:4200 我的 Spring Boot 应用程序在“ http://localhost:8080/api ”上运行:端口号:8080。
没有直接的答案可以解决这个问题。有一些技巧可以禁用 Chrome 中的安全性,使用 NGINX 可以解决此问题。
angular ×1
angular6 ×1
cors ×1
cross-domain ×1
java ×1
phantomjs ×1
selenium ×1
spring-boot ×1
webdriver ×1