Below is my current favorite method to wait for an element to appear or become useful on a dynamic web page. In this case, my example is avoiding the exception thrown when webdriver fails to find an element by using the ‘find_elements’(plural) method rather than a ‘find_element’(singular) The ‘find_elements’ methods always return a list, even if empty, rather than throw an exception. Both are useful, but in this case I like the more readable code without the try/except requirements.
Here’s a bit of code from a post that was lost when my old site went down, data and all. I don’t recall if the original post was this python version or my original Java version (sorry if that’s what you’re here for, ask in comments and I can find and post that too) It’s an implementation of an ‘assert’ statement that allows for the test to continue on failure, storing the error.
I needed to merge my wifes iTunes Library with mine, and decided to write a python script to handle it for me. My main requirement was to not create duplicates, and copy to my library only the music that was exclusive to her library. Basically, copy from hers what I didn’t have. This script should work fine on any two directories with music files. It will simply look for music based on song-title, artist and album info, not by file name or size.
I’ve just finished a new test setup that allows me to capture network traffic in a test suite that is launched by Jenkins onto a Selenium 2 Grid. It was as painful as it sounds, but just as satisfying to complete. One of the big hurdles was the need to run the tests via Jenkins and capture the network traffic generated by the test, which occurs on an unknown Selenium node.