How to select proper Action for web target in Selenium IDE

蓝咒 提交于 2019-12-08 00:37:07

问题


I am new to Selenium IDE. As far as I know, when open Selenium IDE, you will notice that the red 'record macro' button is toggled. This means that selenium will attempt to record every action you make inside the browser. This is a problematic way of recording as we implicitly wait for actions to complete before moving on.

If I only let Selenium to record every actions without specifying extra actions, many test step will be failed with error message : Element not found. I was trying to add extra actions based on Selenium API, like waitForElementPresent, waitForSearch etc.

My question is: How do I know which extra action do I need to add for each web target? Any standard for it? Thanks!


回答1:


I use webdriver but I am familiar with IDE and so far I know it depends on your application how you want to handle the tests. If your application uses ajax calls you might need to use some frequent waitForElementPresent or waitForSearch etc.. and Assertions also depend on the needs of your tests.

Now, the question is how do you know which extra step do you need to insert? Ans. is you will know the necessity. Such as, if your test step depends on a previous ajax call to finish then you know there is a wait necessary and you know what to do. Not to mention, you can always insert extra steps and I am sure you already know that. And, there is no standard for using those. You adjust your tests depending on your necessity




回答2:


you need to go through introduction to selenium ide or just think straight this way that if any action needs loading of page, you simple need to wait for element present and the perform click

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.

these are few points to be noted in selenium ide.

hope this answer would help you!




回答3:


You may want to try Implicit Wait addon for Selenium IDE. It will automatically call WaitForElementPresent before executing actions on that element (like clicks). This may save you some time.




回答4:


Here is the link of Selenium API, all actions can be found here.



来源:https://stackoverflow.com/questions/25809970/how-to-select-proper-action-for-web-target-in-selenium-ide

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!