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

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

  Watch out the outdated articles on the internet.

  當心網(wǎng)上那些過時的文章

  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.

  用模塊化的方式來實現(xiàn)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即可。如果你嘗試重新創(chuàng)建一個比需要更大的DOM,這不但是一種浪費,而且會引入使你的Selenium 功能測試腳本出現(xiàn)不能正常工作風險。

  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.

  恰當?shù)厥褂肳ait

  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下一頁
軟件測試工具 | 聯(lián)系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd
主站蜘蛛池模板: 中国一级毛片国产高清 | 91成人短视频 | 成人黄漫画免费观看网址 | 激情小视频在线播放免费 | 中文字幕高清免费不卡视频 | 久久国产成人午夜aⅴ影院 久久国产欧美日韩精品 | 性xxxx18公交车 | 久久午夜影院 | 精品九九人人做人人爱 | 人与禽的免费一级毛片 | 欧美色成人tv在线播放 | 国产不卡高清 | 成人a视频片在线观看免费 成人a视频高清在线观看 | 中文字幕二区三区 | 国产成人乱码一区二区三区在线 | 色屁屁一区二区三区视频国产 | 天天色综合天天 | 欧美一级网址 | 男女很黄很色床视频网站免 | 欧美日韩中文 | 狠狠色丁香婷婷综合欧美 | 成人免费一级毛片在线播放视频 | 亚洲专区欧美 | 黄色大全免费看 | 国产一区二区免费播放 | 操人的网站 | 亚洲午夜精品久久久久久人妖 | 中国一级淫片bbb | 天堂网在线观看视频 | 国产成人免费无庶挡视频 | 欧美日韩一区二区三区高清不卡 | 99视频精品全部免费观看 | 婷婷免费高清视频在线观看 | 成人一级大片 | 色噜噜视频| 国产99re在线观看只有精品 | 久久国产高清波多野结衣 | aⅴ一区二区三区无卡无码 aⅴ在线免费观看 | 国产成人成人一区二区 | 国产成人精品免费视 | 久久国产成人 |