2014-09-12 17 views
2

我是Selenium IDE的新手。據我所知,當打開Selenium IDE時,你會注意到紅色的「記錄宏」按鈕被切換。這意味着硒會嘗試記錄您在瀏覽器中進行的每一個操作。這是一種有問題的錄音方式,因爲我們在繼續前隱式地等待動作完成。如何在Selenium IDE中爲web目標選擇適當的動作

如果我只讓Selenium在沒有指定額外操作的情況下記錄每個操作,則很多測試步驟將失敗,並顯示錯誤消息:找不到元素。我試圖添加基於Selenium API的額外操作,如waitForElementPresent,waitForSearch等。

我的問題是:如何知道我需要爲每個Web目標添加哪個額外操作?它的任何標準?謝謝!

+0

解決方法:使用eclipse。 – mailmindlin 2014-10-07 14:42:07

回答

1

我使用webdriver,但我熟悉IDE,至今我知道它取決於您的應用程序如何處理測試。如果您的應用程序使用ajax調用,則可能需要使用一些頻繁的waitForElementPresent或waitForSearch等。斷言也取決於您的測試需求。

現在,問題是你如何知道你需要插入哪一步? Ans。你會知道必要性嗎?比如,如果你的測試步驟依賴於之前的ajax調用來完成,那麼你知道需要等待並且你知道該怎麼做。更何況,你總是可以插入額外的步驟,我相信你已經知道這一點。而且,沒有使用這些標準。您根據您的需要調整您的測試

1

你需要通過介紹去硒IDE或只是想直這樣,如果任何行動需要頁面的加載,你簡單的需要等待目前元件和執行單擊

click|target| 
waitForElementPresent|target| 


or if you need to store any value you can use 

storeEval|target|value 

also the variable name in the selenium ide is named followed by $variableName 
enter can be performed as ${KEY_ENTER} 

to verify any value we can use AssertValue or VerifyValue 
the difference between assert and verify is that assert stops the execution of test case if the  value is false whereas verify gives error and execute next statement. 

這些是硒元素中值得注意的幾點。

希望這個答案能幫助你!

0

這裏是Selenium API的鏈接,所有操作都可以在這裏找到。

+0

鏈接已損壞。 – xinaiz 2017-08-02 20:23:05

1

您可能需要爲Selenium IDE嘗試Implicit Wait addon。它會在對該元素執行操作之前自動調用WaitForElementPresent(如點擊)。這可以爲你節省一些時間。

相關問題