欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

WebDriver: Getting it to play nicely with Xv

系統 2088 0

http://www.markhneedham.com/blog/2011/12/15/webdriver-getting-it-to-play-nicely-with-xvfb/

?


Thoughts on Software Development

?

with 2 comments

Another thing we’ve been doing with WebDriver is having it run with the FirefoxDriver while redirecting the display output into the? Xvfb framebuffer ?so that we can run it on our continuous integration agents which don’t have a display attached.

The first thing we needed to do was set the environment property ‘webdriver.firefox.bin’ to our own script which would point the display to Xvfb before starting Firefox:

                  import java.lang.System._

lazy val firefoxDriver: FirefoxDriver = {

  setProperty("webdriver.firefox.bin", "/our/awesome/starting-firefox.sh")

  new FirefoxDriver()

}
                

Our first version of the script looked like this:

/our/awesome/starting-firefox.sh

                  #!/bin/bash

?

rm -f ~/.mozilla/firefox/*/.parentlock

rm -rf /var/go/.mozilla

?

?

XVFB=`which xVfb`

if [ "$?" -eq 1 ];

then

    echo "Xvfb not found."

    exit 1

fi

?

$XVFB :99 -ac &

?

?

BROWSER=`which firefox`

if [ "$?" -eq 1 ];

then

    echo "Firefox not found."

    exit 1

fi

?

export DISPLAY=:99

$BROWSER &
                

The mistake we made here was that we started Xvfb in the background which meant that sometimes it hadn’t actually started by the time Firefox tried to connect to the display and we ended up with this error message:

                  No Protocol specified

Error cannot open display :99
                

We really wanted to keep Xvfb running regardless of whether the Firefox instances being used by WebDriver were alive or not so we moved the starting of Xvfb out into a separate script which we run as one of the earlier steps in the build.

We also struggled to get the FirefoxDriver to kill itself after each test as calling ‘close’ or ‘quit’ on the driver didn’t seem to kill off the process.

We eventually resorted to putting a ‘pkill firefox’ statement at the start of our firefox starting script:

/our/awesome/starting-firefox.sh

                  #!/bin/bash

?

rm -f ~/.mozilla/firefox/*/.parentlock

rm -rf /var/go/.mozilla

?

pkill firefox

?

BROWSER=`which firefox`

if [ "$?" -eq 1 ];

then

    echo "Firefox not found."

    exit 1

fi

?

export DISPLAY=:99

$BROWSER &
                

It’s a bit hacky but it does the job more deterministically than anything else we’ve tried previously.

Be Sociable, Share!

WebDriver: Getting it to play nicely with Xvfb


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 波多野结衣亚洲一区二区三区 | 久久久免费视频观看 | 老头巨大校花体内驰骋小说文 | 天天色综合社区 | 欧美精品免费看 | 欧美一级久久久久久久大片 | 久久综合一区二区 | 欧美日韩亚洲国内综合网俺 | 欧美午夜视频 | 五月婷婷激情第五季 | 亚洲美女在线播放 | 国产亚洲精品久久一区二区三区 | 亚洲欧美中文日韩在线v日本 | 日韩毛片大全免费高清 | 五月综合激情在线 | 色综合色狠狠天天久久婷婷基地 | 97日日摸天天碰免费视频 | 亚洲成人黄色在线 | 91一区二区三区在线观看 | 成人免费无毒在线观看网站 | 天天天天 | 免费精品久久久久久中文字幕 | 日韩黄色视屏 | 欧美精品一二区 | 拍拍拍无遮挡高清视频在线网站 | 亚洲免费一区 | 国产高清美女一级a毛片久久 | 国产激情一级毛片久久久 | 国产精品久久久精品 | 欧美成人免费全网站大片 | 午夜精品一区 | a级淫片 | 欧美a级v片不卡在线观看 | 久草资源在线视频 | 成人免费久久精品国产片久久影院 | 人人模人人干 | 久久狠狠一本精品综合网 | 97碰碰在线视视频 | 亚洲精品乱码久久久久久 | 日韩a无吗一区二区三区 | 欧美区在线 |