国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Web自動(dòng)化測(cè)試 Selenium 1/3

這篇具有很好參考價(jià)值的文章主要介紹了Web自動(dòng)化測(cè)試 Selenium 1/3。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

??? 交流討論:歡迎加入我們一起學(xué)習(xí)!

?? 資源分享耗時(shí)200+小時(shí)精選的「軟件測(cè)試」資料包

???教程推薦:火遍全網(wǎng)的《軟件測(cè)試》教程??

??歡迎點(diǎn)贊 ?? 收藏 ?留言 ?? 如有錯(cuò)誤敬請(qǐng)指正!

Selenium?名字的來源

在這里,我還想說一下關(guān)于?Selenium?名字的來源,很有意思的?:?>?:?Selenium?的中文名為?“?硒?”?,是一種化學(xué)元素的名字,它?對(duì)?汞?(?Mercury?)有天然的解毒作用,實(shí)驗(yàn)表明汞暴露水平越高,硒對(duì)汞毒性的拮抗作用越明顯,所以說硒是汞的克星。大家應(yīng)該知道?Mercury?測(cè)試工具系?列吧(?QTP?,?QC?,?LR?,?WR...?),他們功能強(qiáng)大,但卻價(jià)格不菲,大家對(duì)此又愛又恨!故?thoughtworks?特意把他們的?Web?開源測(cè)試工具命?名為?Selenium?,以此幫助大家脫離汞毒。

產(chǎn)品類別

Selenium?IDE

一個(gè)用于構(gòu)造測(cè)試腳本的原型工具。它是一個(gè)Firefox插件,并且提供了一個(gè)易于使用的開發(fā)自動(dòng)化測(cè)試的接口。Selenium?IDE有一個(gè)錄制功能,可以記錄用戶執(zhí)行的動(dòng)作,然后可以導(dǎo)出它們作可重用的腳本

Remote?Control

Selenium?RC是最重要的Seleniumx項(xiàng)目,在WebDriver/Selenium合并產(chǎn)生Selenium?2

WebDriver

Selenium?2是該項(xiàng)目的未來方向,和對(duì)Selenium工具包的最新的增加物。

Grid

如果你必須運(yùn)行你的測(cè)試集在多個(gè)環(huán)境,你可以有不同的遠(yuǎn)程機(jī)器的支持和運(yùn)行你的測(cè)試在同一時(shí)間在不同的遠(yuǎn)程機(jī)器上。在任何一種情形下,Selenium都將充分利用并行處理,極大地改善運(yùn)行你的測(cè)試所花費(fèi)的時(shí)間。

瀏覽器支持

官方文檔?http://docs.seleniumhq.org/docs/01_introducing_selenium.jsp#supported-browsers-and-platforms

實(shí)戰(zhàn)操作

準(zhǔn)備

IE?Chrome的Driver安裝和準(zhǔn)備

https://code.google.com/p/selenium/wiki/ChromeDriver

https://code.google.com/p/selenium/wiki/InternetExplorerDriver

RemoteControl的不同瀏覽器Java代碼

package?base;

import?org.openqa.selenium.*;

import?org.openqa.selenium.ie.*;

import?org.openqa.selenium.remote.*;

import?static?org.testng.Assert.*;

import?org.testng.annotations.*;

import?com.thoughtworks.selenium.Selenium;

import?java.io.*;

import?java.net.*;

public?class?BaseRC?{

protected?Selenium?selenium;

private?WebDriver?driver?=?null;

private?StringBuffer?verificationErrors?=?new?StringBuffer();

@Parameters({?"platform",?"browser",?"version",?"url"?})

@BeforeTest(alwaysRun?=?true)

public?void?setup(String?platform,?String?browser,?String?version,

String?url)?throws?MalformedURLException,?IOException?{

DesiredCapabilities?caps?=?null;

//?Browsers

if?(browser.equalsIgnoreCase("Internet?Explorer"))?{

System.setProperty("webdriver.ie.driver",

"c:\\test\\IEDriverServer.exe");

caps?=?DesiredCapabilities.internetExplorer();

//?IE安全設(shè)置

caps.setCapability( InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,

true);

//?browser?zoom?level?must?be?set?to?100%

}?else?if?(browser.equalsIgnoreCase("Firefox"))?{

System.setProperty("webdriver.firefox.bin",

"C:\\test\\Firefox4\\firefox.exe");

caps?=?DesiredCapabilities.firefox();

}?else?if?(browser.equalsIgnoreCase("chrome"))?{

System.setProperty("webdriver.chrome.driver",

"c:\\test\\chromedriver.exe");

caps?=?DesiredCapabilities.chrome();

caps.setCapability(

"chrome.binary",

"C:\\test\\Chrome31\\chrome.exe");

}?else?if?(browser.equalsIgnoreCase("iPad"))

caps?=?DesiredCapabilities.ipad();

else?if?(browser.equalsIgnoreCase("Android"))

caps?=?DesiredCapabilities.android();

//?Platforms

if?(platform.equalsIgnoreCase("Windows"))

caps.setPlatform(org.openqa.selenium.Platform.WINDOWS);

else?if?(platform.equalsIgnoreCase("MAC"))

caps.setPlatform(org.openqa.selenium.Platform.MAC);

else?if?(platform.equalsIgnoreCase("Andorid"))

caps.setPlatform(org.openqa.selenium.Platform.ANDROID);

//?Version

caps.setVersion(version);

driver?=?new?RemoteWebDriver(new?URL(

"http://localhost:4444/wd/hub"),?caps);

selenium?=?new?WebDriverBackedSelenium(driver,?url);

}

@AfterTest

public?void?afterTest()?{

//?Close?the?browser

driver.quit();

selenium.stop();

String?verificationErrorString?=?verificationErrors.toString();

if?(!"".equals(verificationErrorString))?{

fail(verificationErrorString);

}

}

}

WebDriver的不同瀏覽器Java代碼

package?base;

import?org.openqa.selenium.*;

import?org.openqa.selenium.firefox.*;

import?org.openqa.selenium.ie.*;

import?org.openqa.selenium.chrome.*;

import?org.openqa.selenium.remote.*;

import?org.openqa.selenium.support.ui.ExpectedCondition;

import?org.openqa.selenium.support.ui.WebDriverWait;

import?static?org.testng.Assert.*;

import?org.testng.annotations.*;

import?java.io.*;

import?java.net.*;

public?class?BaseWebDriver?{

protected?WebDriver?driver?=?null;

private?StringBuffer?verificationErrors?=?new?StringBuffer();

@Parameters({?"platform",?"browser",?"version",?"url"?})

@BeforeTest(alwaysRun?=?true)

public?void?setup(String?platform,?String?browser,?String?version,

String?url)?throws?MalformedURLException,?IOException?{

DesiredCapabilities?caps?=?null;

//?Browsers

if?(browser.equalsIgnoreCase("Internet?Explorer"))?{

System.setProperty("webdriver.ie.driver",

"c:\\test\\IEDriverServer.exe");

caps?=?DesiredCapabilities.internetExplorer();

//?IE安全設(shè)置

caps.setCapability(

InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,

true);

//?browser?zoom?level?must?be?set?to?100%

}?else?if?(browser.equalsIgnoreCase("Firefox"))?{

System.setProperty("webdriver.firefox.bin",

"C:\\test\\Firefox4\\firefox.exe");

caps?=?DesiredCapabilities.firefox();

}?else?if?(browser.equalsIgnoreCase("chrome"))?{

System.setProperty("webdriver.chrome.driver",

"c:\\test\\chromedriver.exe");

caps?=?DesiredCapabilities.chrome();

caps.setCapability(

"chrome.binary",

"C:\\test\\Chrome31\\chrome.exe");

}?else?if?(browser.equalsIgnoreCase("iPad"))

caps?=?DesiredCapabilities.ipad();

else?if?(browser.equalsIgnoreCase("Android"))

caps?=?DesiredCapabilities.android();

//?Platforms

if?(platform.equalsIgnoreCase("Windows"))

caps.setPlatform(org.openqa.selenium.Platform.WINDOWS);

else?if?(platform.equalsIgnoreCase("MAC"))

caps.setPlatform(org.openqa.selenium.Platform.MAC);

else?if?(platform.equalsIgnoreCase("Andorid"))

caps.setPlatform(org.openqa.selenium.Platform.ANDROID);

//?Version

caps.setVersion(version);

driver?=?new?RemoteWebDriver(new?URL(

"http://localhost:4444/wd/hub"),?caps);

driver.get(url);

//

WebDriverWait?wait?=?new?WebDriverWait(driver,?10);

wait.until(new?ExpectedCondition<WebElement>()?{

@Override

public?WebElement?apply(WebDriver?d)?{

return?d.findElement(By.id("login"));

}

});

}

/* @Test(description?=?"TestDemo")

public?void?testDemo()?throws?InterruptedException?{

//?Sleep?until?the?div?we?want?is?visible?or?5?seconds?is?over

long?end?=?System.currentTimeMillis()?+?5000;

while?(System.currentTimeMillis()?<?end)?{

WebElement?resultsDiv?=?driver.findElement(By.id("container"));

//?If?results?have?been?returned,?the?results?are?displayed?in?a

//?drop?down.

if?(resultsDiv.isDisplayed())?{

break;

}

}

}*/

@AfterTest

public?void?afterTest()?{

//?Close?the?browser

driver.quit();

//driver.close();

String?verificationErrorString?=?verificationErrors.toString();

if?(!"".equals(verificationErrorString))?{

fail(verificationErrorString);

}

}

}

Grid下的不同瀏覽器運(yùn)行腳本

總控運(yùn)行

rem??http://localhost:4444/grid/console?可以查看hub總控的信息

java?-jar?selenium-server-standalone-2.35.0.jar?-role?hub?-port?4444?-nodeTimeout?600

各種瀏覽器運(yùn)行的腳本

參數(shù)設(shè)置相同的部分[IP?RC/WD運(yùn)行模式]

@echo?off

set?a=0

for?%%a?in?(%*)?do?set?/a?a+=1

echo?"%a%?argc"

Rem?可變的設(shè)置

set?PORT=8902?

if?%a%==1?(

if?"%1%"==""?(

?set?IP="localhost"

)?else?(

?set?IP=%1%

)

set?MODE="webdriver"

)?else?(

if?"%1%"==""?(

?set?IP="localhost"

)?else?(

?set?IP=%1%

)

if?"%2%"=="rc"?(

?set?MODE="node"

?set?PORT=9902

)?else?(

?set?MODE="webdriver"

)

)

echo?%IP%?%MODE%

不同瀏覽器的運(yùn)行參數(shù)

java?-Dwebdriver.chrome.driver="c:\test\chromedriver.exe"?-jar?selenium-server-standalone-2.35.0.jar?-role?%MODE%?-hubHost?%IP%?-port?%PORT%?-timeout?20000?-browser?"browserName=chrome,version=31,maxInstances=2,platform=WINDOWS,chrome.binary=C:\test\Chrome31\chrome.exe"

rem?java?-jar?selenium-server-standalone-2.35.0.jar?-h?可以查看幫助參數(shù)

rem?!!!?-browser參數(shù)中,逗號(hào)之間不要有空格

java?-jar?selenium-server-standalone-2.35.0.jar?-role?%MODE%?-hubHost?%IP%?-port?%PORT%?-timeout?20000?-browser?"browserName=firefox,version=4,maxInstances=1,platform=WINDOWS,firefox_binary=C:\test\Firefox4\firefox.exe"

java?-Dwebdriver.ie.driver="c:\test\IEDriverServer.exe"?-jar?selenium-server-standalone-2.35.0.jar?-role?%MODE%?-hubHost?%IP%?-port?%PORT%?-timeout?20000?-browser?"browserName=internet?explorer,version=8,maxInstances=1,platform=WINDOWS"

最后我邀請(qǐng)你進(jìn)入我們的【軟件測(cè)試學(xué)習(xí)交流群:785128166】, 大家可以一起探討交流軟件測(cè)試,共同學(xué)習(xí)軟件測(cè)試技術(shù)、面試等軟件測(cè)試方方面面,還會(huì)有免費(fèi)直播課,收獲更多測(cè)試技巧,我們一起進(jìn)階Python自動(dòng)化測(cè)試/測(cè)試開發(fā),走向高薪之路

作為一個(gè)軟件測(cè)試的過來人,我想盡自己最大的努力,幫助每一個(gè)伙伴都能順利找到工作。所以我整理了下面這份資源,現(xiàn)在免費(fèi)分享給大家,有需要的小伙伴可以關(guān)注【公眾號(hào):程序員二黑】自提!

Web自動(dòng)化測(cè)試 Selenium 1/3,selenium,python,壓力測(cè)試,單元測(cè)試,軟件測(cè)試,自動(dòng)化測(cè)試

Web自動(dòng)化測(cè)試 Selenium 1/3,selenium,python,壓力測(cè)試,單元測(cè)試,軟件測(cè)試,自動(dòng)化測(cè)試文章來源地址http://www.zghlxwxcb.cn/news/detail-838478.html

到了這里,關(guān)于Web自動(dòng)化測(cè)試 Selenium 1/3的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 基于Selenium+Python的web自動(dòng)化測(cè)試框架詳解

    目錄 一、什么是Selenium? 二、自動(dòng)化測(cè)試框架 三、自動(dòng)化框架的設(shè)計(jì)和實(shí)現(xiàn) 四、需要改進(jìn)的模塊 五、總結(jié) Selenium是一個(gè)基于瀏覽器的自動(dòng)化測(cè)試工具,它提供了一種跨平臺(tái)、跨瀏覽器的端到端的web自動(dòng)化解決方案。Selenium主要包括三部分:Selenium IDE、Selenium WebDriver 和Selen

    2024年02月09日
    瀏覽(29)
  • selenium+python做web端自動(dòng)化測(cè)試框架實(shí)戰(zhàn)

    selenium+python做web端自動(dòng)化測(cè)試框架實(shí)戰(zhàn)

    最近受到萬點(diǎn)暴擊,由于公司業(yè)務(wù)出現(xiàn)問題,工作任務(wù)沒那么繁重,有時(shí)間摸索selenium+python自動(dòng)化測(cè)試,結(jié)合網(wǎng)上查到的資料自己編寫出適合web自動(dòng)化測(cè)試的框架,由于本人也是剛剛開始學(xué)習(xí)python,這套自動(dòng)化框架目前已經(jīng)基本完成了所以總結(jié)下編寫的得失,便于以后回顧溫

    2024年02月14日
    瀏覽(26)
  • 基于python實(shí)現(xiàn)Web自動(dòng)化測(cè)試(selenium)、API自動(dòng)化測(cè)試(requests)&附學(xué)習(xí)視頻

    基于python實(shí)現(xiàn)Web自動(dòng)化測(cè)試(selenium)、API自動(dòng)化測(cè)試(requests)&附學(xué)習(xí)視頻

    另一篇文章 :自動(dòng)化測(cè)試框架(pytest)附學(xué)習(xí)視頻 學(xué)習(xí)視頻,學(xué)習(xí)文檔-白月黑羽 說明: 1緊跟著寫的不加/,不加空格-表示同一級(jí)別信息,加空格表示后代 2.css定位tag,id,class時(shí)分別有不同的標(biāo)識(shí),其他屬性都要加[]進(jìn)行搜索, Xpath所有屬性都要都加【】,tag不用 3. css在使用ta

    2024年02月03日
    瀏覽(24)
  • Python + Selenium,分分鐘搭建 Web 自動(dòng)化測(cè)試框架!

    Python + Selenium,分分鐘搭建 Web 自動(dòng)化測(cè)試框架!

    在程序員的世界中,一切重復(fù)性的工作,都應(yīng)該通過程序自動(dòng)執(zhí)行。 「自動(dòng)化測(cè)試」就是一個(gè)最好的例子。 隨著互聯(lián)網(wǎng)應(yīng)用開發(fā)周期越來越短,迭代速度越來越快,只會(huì)點(diǎn)點(diǎn)點(diǎn),不懂開發(fā)的手工測(cè)試,已經(jīng)無法滿足如今的業(yè)務(wù)要求,只能被企業(yè)逐步裁員淘汰。 「自動(dòng)化測(cè)試

    2024年02月02日
    瀏覽(29)
  • selenium+python web自動(dòng)化測(cè)試框架項(xiàng)目實(shí)戰(zhàn)實(shí)例教程

    selenium+python web自動(dòng)化測(cè)試框架項(xiàng)目實(shí)戰(zhàn)實(shí)例教程

    自動(dòng)化測(cè)試對(duì)程序的回歸測(cè)試更方便。 由于回歸測(cè)試的動(dòng)作和用例是完全設(shè)計(jì)好的,測(cè)試期望的結(jié)果也是完全可以預(yù)料的,將回歸測(cè)試自動(dòng)運(yùn)行... 可以運(yùn)行更加繁瑣的測(cè)試 自動(dòng)化測(cè)試的一個(gè)明顯好處就是可以在很短的時(shí)間內(nèi)運(yùn)行更多的測(cè)試。學(xué)習(xí)自動(dòng)化測(cè)試最終目的是應(yīng)用到

    2024年02月06日
    瀏覽(36)
  • web自動(dòng)化測(cè)試入門篇04——selenium+python基礎(chǔ)方法封裝

    web自動(dòng)化測(cè)試入門篇04——selenium+python基礎(chǔ)方法封裝

    ? ? ?? 作者簡(jiǎn)介:博主是一位測(cè)試管理者,同時(shí)也是一名對(duì)外企業(yè)兼職講師。 ?? 主頁地址:【Austin_zhai】 ?? 目的與景愿:旨在于能幫助更多的測(cè)試行業(yè)人員提升軟硬技能,分享行業(yè)相關(guān)最新信息。 ?? 聲明:博主日常工作較為繁忙,文章會(huì)不定期更新,各類行業(yè)或職場(chǎng)問

    2024年02月03日
    瀏覽(21)
  • 【python】之selenium模塊,實(shí)現(xiàn)Web端自動(dòng)化測(cè)試!【基礎(chǔ)篇】

    【python】之selenium模塊,實(shí)現(xiàn)Web端自動(dòng)化測(cè)試!【基礎(chǔ)篇】

    Selenium是一個(gè)Web的自動(dòng)化測(cè)試工具,最初是為網(wǎng)站自動(dòng)化測(cè)試而開發(fā)的,Selenium 可以直接調(diào)用瀏覽器,它支持所有主流的瀏覽器(包括PhantomJS這些無界面的瀏覽器),可以接收指令,讓瀏覽器自動(dòng)加載頁面,獲取需要的數(shù)據(jù),甚至頁面截屏等。我們可以使用selenium很容易完成之

    2024年02月06日
    瀏覽(28)
  • web自動(dòng)化測(cè)試框架落地實(shí)施全過程-測(cè)試環(huán)境搭建 (Selenium+Python)

    web自動(dòng)化測(cè)試框架落地實(shí)施全過程-測(cè)試環(huán)境搭建 (Selenium+Python)

    Web自動(dòng)化測(cè)試是指使用自動(dòng)化工具模擬用戶在Web瀏覽器中執(zhí)行的操作,通過編寫腳本來自動(dòng)化執(zhí)行測(cè)試用例,以驗(yàn)證Web應(yīng)用程序的功能、性能和兼容性等方面的質(zhì)量。其主要目的是降低測(cè)試成本和時(shí)間,并提高測(cè)試效率和準(zhǔn)確性。 Web自動(dòng)化測(cè)試通常包括以下步驟: 確定測(cè)試

    2024年02月09日
    瀏覽(20)
  • Mac OS下應(yīng)用Python+Selenium實(shí)現(xiàn)web自動(dòng)化測(cè)試

    Mac OS下應(yīng)用Python+Selenium實(shí)現(xiàn)web自動(dòng)化測(cè)試

    在Mac環(huán)境下應(yīng)用Python+Selenium實(shí)現(xiàn)web自動(dòng)化測(cè)試 在這個(gè)過程中要注意兩點(diǎn): 1.在終端聯(lián)網(wǎng)執(zhí)行命令“sudo pip install –U selenium”如果失敗了的話,可以嘗試用命令“sudo easy_install selenium”來安裝selenium; 2.安裝好PyCharm后新建project,Interpreter一定要選對(duì),默認(rèn)給出的兩個(gè)可選項(xiàng)很有可

    2024年02月12日
    瀏覽(26)
  • ?selenium+python做web端自動(dòng)化測(cè)試框架與實(shí)例詳解教程

    ?selenium+python做web端自動(dòng)化測(cè)試框架與實(shí)例詳解教程

    最近受到萬點(diǎn)暴擊,由于公司業(yè)務(wù)出現(xiàn)問題,工作任務(wù)沒那么繁重,有時(shí)間摸索selenium+python自動(dòng)化測(cè)試,結(jié)合網(wǎng)上查到的資料自己編寫出適合web自動(dòng)化測(cè)試的框架,由于本人也是剛剛開始學(xué)習(xí)python,這套自動(dòng)化框架目前已經(jīng)基本完成了所以總結(jié)下編寫的得失,便于以后回顧溫

    2024年02月10日
    瀏覽(36)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包