- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
出于某种原因,我的代码在应使用phantomjs时尝试使用firefox浏览器。
我的常规代码如下所示:
import geb.Browser
...
env = System.getenv()
def username = env.username
def password = env.password
def gateway = env.gateway
def matcher = gateway =~ /^(https?:\/\/)([^:^\/]*)(:\d*)?(.*)?.*$/
def host = matcher[0][2]
def port = matcher[0][3]
if (env.driver == 'firefox') {
driver = new FirefoxDriver()
} else {
println env.phantomjspath
def caps = DesiredCapabilities.phantomjs()
caps.setCapability(
PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, env.phantomjspath
)
driver = new PhantomJSDriver(caps)
driver.manage().window().setSize(new Dimension(1028, 768))
}
def browser = new Browser(driver: driver)
BiHome = "https://" + username + ":" + password + "@" + host + port + "/gateway/default/BigInsightsWeb/#/welcome"
browser.drive {
go BiHome
// code omitted for brevity
}
browser.close()
:CheckHomePhantomJS
/Users/snowch/Repos/biginsight-examples2/examples/BiginsightsHome/build/webdriver/phantomjs/bin/phantomjs
May 10, 2016 10:13:57 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: executable: /Users/snowch/Repos/biginsight-examples2/examples/BiginsightsHome/build/webdriver/phantomjs/bin/phantomjs
May 10, 2016 10:13:57 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: port: 19084
May 10, 2016 10:13:57 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: arguments: [--webdriver=19084, --webdriver-logfile=/Users/snowch/Repos/biginsight-examples2/examples/BiginsightsHome/phantomjsdriver.log]
May 10, 2016 10:13:57 AM org.openqa.selenium.phantomjs.PhantomJSDriverService <init>
INFO: environment: {}
PhantomJS is launching GhostDriver...
[INFO - 2016-05-10T09:13:58.925Z] GhostDriver - Main - running on port 19084
[INFO - 2016-05-10T09:13:59.117Z] Session [8784a390-168f-11e6-bcd7-a7a5f8e205b1] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.7 Safari/534.34","webSecurityEnabled":true}
[INFO - 2016-05-10T09:13:59.117Z] Session [8784a390-168f-11e6-bcd7-a7a5f8e205b1] - page.customHeaders: - {}
[INFO - 2016-05-10T09:13:59.117Z] Session [8784a390-168f-11e6-bcd7-a7a5f8e205b1] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"1.9.7","driverName":"ghostdriver","driverVersion":"1.1.0","platform":"mac-unknown-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
[INFO - 2016-05-10T09:13:59.117Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 8784a390-168f-11e6-bcd7-a7a5f8e205b1
Exception in thread "main" org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed. OS appears to be: MAC
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'xxxxxxx', ip: 'xxxxx', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: 'xxxxx', java.version: '1.8.0_66'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.firefox.internal.Executable.<init>(Executable.java:75)
at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:60)
at org.openqa.selenium.firefox.FirefoxBinary.<init>(FirefoxBinary.java:56)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:120)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
....
import org.apache.tools.ant.taskdefs.condition.Os
// set the dependencies for running the groovy script
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.codehaus.groovy:groovy-all:latest.release'
}
}
plugins {
id 'groovy'
}
apply from: "osSpecificDownloads.gradle"
// set the dependencies for compiling the groovy script
repositories {
mavenCentral()
}
dependencies {
compile 'org.codehaus.groovy:groovy-all:latest.release'
compile 'org.codehaus.geb:geb-core:latest.release'
compile 'org.seleniumhq.selenium:selenium-firefox-driver:2.53.0'
compile('com.codeborne:phantomjsdriver:1.3.0') {
transitive = false
}
}
// tell gradle the groovy script is in the same folder as the build.gradle file
sourceSets {
main {
groovy {
srcDirs = ['.']
}
}
}
Properties props = new Properties()
props.load(new FileInputStream("$projectDir/../../connection.properties"))
task("CheckHomePhantomJS", type: JavaExec) {
dependsOn unzipPhantomJs
def phantomJsFilename = Os.isFamily(Os.FAMILY_WINDOWS) ? "phantomjs.exe" : "bin/phantomjs"
environment 'phantomjspath', new File(unzipPhantomJs.outputs.files.singleFile, phantomJsFilename).absolutePath
environment 'driver', 'phantomjs'
environment 'gateway', props.gateway
environment 'username', props.username
environment 'password', props.password
main = 'CheckHome'
classpath = sourceSets.main.runtimeClasspath
}
最佳答案
调用时,Geb会创建一个新的Browser实例。
Browser drive(Closure script)
Browser drive(Browser browser, Closure script)
Browser.drive(browser) {
go BiHome
// code omitted for brevity
}
关于gradle - geb.Browser尝试使用FirefoxDriver代替PhatomJSDriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37134240/
在 Firefox 扩展的 Javascript 中,您可以调用 gBrowser.getBrowserForTab但是没有gBrowser.getTabForBrowser .所以我写了自己的并且它
在问这个可能含糊不清的问题之前,我搜索了 SO,发现许多对“现代浏览器”的引用,但没有定义。由于这是一个被广泛使用和引用的术语,令我惊讶的是我在 Internet 上找不到定义甚至描述。 那么,在 2
更新:老问题仅适用于 IE11 预览版;浏览器模式在 IE11 最终版本中回归。但有一个问题:它几乎没有用,因为它不模拟条件注释。例如,如果您使用它们在旧版 IE 中启用 HTML5 支持,您将无法再
我的移动页面和短信有问题:链接。该页面主要由基于 Android 和 iOS 的智能手机通过 QR 扫描应用程序访问。 特别是在 iPhone 上,有一些带有集成浏览器的 QR 应用程序(webkit
我想使用 CustomTabsIntent。但是我没有找到androidx的customTabs路径和版本。 最后我得到了这个:androidx.browser:browser:1.0.0 我想知道正
我想将来自不同域(支付提供商)的 ssl 安全页面加载到 iframe 中。据我所知,一些(或全部?)浏览器会在页面的某些部分受到保护而其他部分不安全时警告用户。 这是真的吗? 如果是这样,如果主站点
在 Protractor 中,有 browser.pause() function : Beta (unstable) pause function for debugging webdriver t
我可以使用以下方法检索浏览器日志 browser.manage().logs().get('browser').then(function(browserLog) { logger.info('
当使用 protractor 时,全局变量 browser 似乎具有 browser.driver 的所有功能。 我特地问这个是因为我不确定是使用 browser.wait 还是 browser.dr
面对 Protractor 的计时问题。有时我的 Protractor 测试用例会因网络或性能问题而失败。我已经解决了 browser.sleep() 的现有问题。后来知道了browser.wait(
我仍然无法找到解决此问题的方法。我们有一个启动浏览器窗口的应用程序,但我们使用的底层第三方插件尚不支持 IE9。我知道我可以通过点击 F12 并选择它来切换到 IE8 的浏览器模式。 有没有办法在命令
在 Protractor 脚本中,我总是遇到超时问题,即使我设置了很大的 time out jasmine interval、allscripttimeout...在某些地方,我不得不等到元素出现,比
我正在运行一个 Angular 应用程序,并且在 Protractor 上测试时尝试获取当前 URL。使用哪一个? browser.driver.getCurrentUrl() 或 browser.g
“所有浏览器兼容”和“跨浏览器兼容”有什么区别? “交叉”是什么意思,是指不同的操作系统吗? 如果任何网站在 IE 7、8 FF 3+、Safari 3+ 的桌面版本上运行良好,我们可以说它是跨浏
不明白浏览器同步中的错误阅读文档,其中 gulp 4 真的没有写任何关于它的内容。在 gulp 4 的文档中也没有理解(异步)。如何解决这个问题。谢谢。 bla bla bla bla bla bla
我正在尝试在 ASP.Net C# 代码隐藏中执行“如果浏览器是 IE 且版本低于 9”。 但是,在 chrome 中,以下行: if (Request.Browser.Browser == "IE"
我第一次玩 watir,使用 this site作为指导。我在一个简单的程序(如下)中遇到错误 - 它在第一个非要求行失败,如图所示。 如果我没有运行下面显示的内容,而是删除了该行,它会打开一个空的
下面的 if 条件我认为它是说 - 如果浏览器是 IE 并且 IE 浏览器版本高于 9,但我没有 IE 9 来测试它,所以很难知道正确的输出,这也是不是 100% 的我想要的 bcos 默认情况下该脚
我通过 Pingdom 测试了我的网站并得到了这个: 我进行了搜索,但找不到解决方案。有谁知道我怎样才能得到这个14到100? 最佳答案 不是一个完整的解决方案,但您可以通过将两个请求合并为一个来改善
是否可以禁用浏览器/窗口之间的 HTML5 拖放功能? 我正在使用具有 native HTML5 拖放功能的 Angular2 应用程序,并希望防止用户将其拖动到浏览器窗口之外并防止将可拖动对象拖放到
我是一名优秀的程序员,十分优秀!