开发者

Selenium extensions: "blocking" commands

开发者 https://www.devze.com 2022-12-18 06:30 出处:网络
Is it possible in selenium to write blocking commands? I want to make a \"clickAndWaitForAjax\" comma开发者_如何学Pythonnd. It will click a button and wait until a div is filled with text from the se

Is it possible in selenium to write blocking commands?

I want to make a "clickAndWaitForAjax" comma开发者_如何学Pythonnd. It will click a button and wait until a div is filled with text from the server.

It is clear to me this can be done with two commands, but can it be done with one? How?


The best practise for this is to wait for elements on the page to be in the div. You can use a number of different commands like waitForElementPresent, waitForElementVisible,etc or you can write some JavaScript to check if the element in the DOM and use waitForCondition.

These are standard Selenium commands and can be ported to a programming language of your choice if you wish to run your tests running Selenium RC


If you write your scripts as JUnit tests, then it's all just Java code. You can easily write a single method that calls one, two, or a whole lot of different selenium methods. Or you could use your favourite language and testing framework.

This makes it much easier for testing complex systems.

See Selenium RC documentation for details.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号