您的位置:軟件測試 > 開源軟件測試 > 開源功能測試工具 > Watir
    Watir Webdriver的mobile測試
    作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時(shí)間:[ 2014/1/15 15:20:09 ] 推薦標(biāo)簽:Watir Webdriver

    實(shí)際上,Watir Webdriver可以測試的仍然是Site,不是APP,可以用于測試mobile device訪問的mobile site的方式有三種:

    1. 在一個(gè)真實(shí)的設(shè)備上,利用內(nèi)置的browser進(jìn)行測試
    2. 在一個(gè)仿真的設(shè)備上,利用內(nèi)置的browser進(jìn)行測試
    3. 在pc機(jī)上,將browser設(shè)置為mobile browser進(jìn)行測試

    對(duì)于在真實(shí)設(shè)備上進(jìn)行測試,速度會(huì)相對(duì)比較慢,而且iOS還需要額外的費(fèi)用。

    而且還需要在iOS和Android的設(shè)備上先安裝相應(yīng)的driver。

    所以簡單的方法,是利用webdriver-user-agent gem 進(jìn)行模擬測試

    方法如下:

    require 'watir-webdriver'
    require 'webdriver-user-agent'
    driver = UserAgent.driver(:browser => :chrome, :agent => :iphone, :orientation => :landscape)
    browser = Watir::Browser.new driver
    browser.goto 'tiffany.com'
    browser.url.should == 'http://m.tiffany.com/International.aspx'


    我們可以看到,關(guān)鍵的是:

    driver = UserAgent.driver(:browser => :chrome, :agent => :iphone, :orientation => :landscape)

    這個(gè)步驟,指明了你要使用的瀏覽器類型,仿真器類型,和視圖方式。

    該gem可以支持的瀏覽器有ff和chrome
    可以支持的仿真器類型有:iphone, ipad, android_phone, 和android_tablet
    支持的視圖方式有兩種,水平和豎直。 (portrait and landscape)

    軟件測試工具 | 聯(lián)系我們 | 投訴建議 | 誠聘英才 | 申請(qǐng)使用列表 | 網(wǎng)站地圖
    滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd