亚洲好骚综合-亚洲黄色录像-亚洲黄色网址-亚洲黄色网址大全-99久久99久久-99久久99久久精品国产

您的位置:軟件測試 > 開源軟件測試 > 開源功能測試工具 > Selenium
Some selenium tips關于Selenium的小竅門
作者:網絡轉載 發布時間:[ 2013/4/7 15:55:26 ] 推薦標簽:

  Watch out the outdated articles on the internet.

  當心網上那些過時的文章

  Selenium 2.0 is completely different from Selenium 1.x. Selenium 2.0 is also called the selenium webdriver. So always add the keyword webdriver when googling for answers to your selenium related questions.

  Selenium 2.0與Selenium 1.x有非常大的差別。Selenium 2.0 通常也別叫做 selenium webdriver。所以在你google selenium 相關的問題的時候,都請加上 webdriver 這個關鍵字。

  Implement the web UI in a modular way so it's more selenium testable.

  用模塊化的方式來實現Web的UI會提高用Selenium測試的可測性

  Modularize your view logic so that you only update the part of DOM that is needed to change when your models change. If you tend to re-create a bigger part of the DOM than necessary, it's not only a waste but also could introduce risk to your functional tests written in Selenium.

  模塊化你的View邏輯,這樣做的好處是,當你要更改你的Models時,你只需要更新部分的DOM即可。如果你嘗試重新創建一個比需要更大的DOM,這不但是一種浪費,而且會引入使你的Selenium 功能測試腳本出現不能正常工作風險。

  Reduce unnecessary dependency on DOM structure, make element locating logic as simple as possible.

  減少對DOM結構不必要的依賴,元素定位邏輯的越簡單越好

  When you need to locate an element, try not rely on the DOM structure too much - for example, using code logic to locate element is the most risky one. The best approach is probably to always use a scoped CSS selector with 1 or 2 levels of IDs, And if you can locate it in one selector, don't do it in two. For example

  請盡量不要使用DOM的結構來定位頁面元素,例如,用代碼邏輯來定位元素是風險大的。定位元素好的方式是用1 到2級的CSS selector,如果一個selector 能定位,不要用兩個, 例如

  label = driver.find_element("#info-panel #name-label")

  is more robust than

  比以下的方法健壯

  panel = driver.find_element("#info-panel")

  label = panel.find_element("#name-label")

  Do wait in selenium the smart way.

  恰當地使用Wait

  Don't use implicit wait blindly. Implicit wait makes sense when you use find_element to find one element. But when you try to locate multiple elements by driver.find_elements, the driver will always wait the whole timeout period if implicit wait is set. That might not be what you always want. I usually write my own safe find_element method. Here is an example in the base class of my page objects:

  不要盲目地使用隱式等待。當你使用find_element的時候去找某一個元素時,使用隱式等待是合適的,但是當你嘗試用 driver.find_elements 去定位多個元素時,如果設置了隱式等待,那么drivers 總是會等待整個超時周期。這往往不是你想要的效果。我通常會自己去寫一個安全的 find_element 方法。以下例子展示了我頁面對象的基類

  def s selector

  wait_until { @driver.find_element css: selector }

  end

  def wait_until(&block)

  wait = Selenium::WebDriver::Wait.new(timeout: 10, interval: INTERVAL)

  wait.until &block

  end

  So that I can write the following code in my page object

上一頁12下一頁
軟件測試工具 | 聯系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網站地圖
滬ICP備07036474 2003-2017 版權所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd
主站蜘蛛池模板: 亚洲欧美视屏 | 青青免费在线视频 | 一级在线毛片 | 成人a毛片久久免费播放 | 亚州一级毛片 | 黄色影视大全 | 色噜噜噜 | 日韩中文字幕在线视频 | 成人国产精品 | 免费黄色小视频 | 欧美一级专区免费大片俄罗斯 | 亚洲国产精品自产在线播放 | 两性色午夜视频免费老司机 | 欧美极度另类极品 | 极品美女丝袜被的网站 | 欧美性天天影院欧美狂野 | 成年人深夜福利 | 18在线网站 | 在线观看网址你懂的 | 日韩美女一级片 | 国产精品99久久久久久董美香 | 美女视频黄a视频全免费网站色窝 | 涩涩污 | 欧美一区二区三区综合色视频 | 国产成人在线视频 | 日本肥妇| 1000部禁部视频免费大看 | 亚洲免费在线视频观看 | 欧美激情视频网站 | 乱小说欧美综合 | 成年人视频在线免费观看 | 狠狠躁日日躁人人爽 | 日韩成人在线视频 | 草的爽免费视频 | 不卡的在线视频免费观看 | 国产精品视频第一区二区三区 | 轻轻啪qqp.cc | 久久久高清日本道免费观看 | 成人在线激情视频 | 91.xxx.高清在线 | 色yeye成人免费视频 |