Selenium Assertion Check Fails if There are More Than Four Assertions

As you know that selenium is a open source test automation framework for web application. Since it has many good features and being free make it usable for anyone develops or tests web application. However, if we compare it with well-known, highly cost licensed product selenium has some disadvantages such as, as far as I used it may be the main problem, there is no guaranty if the automation scripts works all the time. Even it works for a run successfully, it may give error after a few seconds of it first run. Therefore to fully utilize it, the drawbacks of  the selenium should be known and the scripts should be redesigned. In this post, I want to explain a selenium experiment about assertion.

Last time I have faced an error related assertion check during automating a new form. Error is related to a error message which can not be found by webdriver and it waits for a trigger to next step. However if I run every assertion one by one there is no error and it finished successfully. Every time when I run all of them together, it waits a when checking the 5th assertion. Changing the 5th assertion with the any of 1, 2, 3, 4 this time again the 5th assertion in sequence gives an error like as below:

File "D:\workspace\web_automation\", line 62, in new_member_form_check 
self.assertRegexpMatches(driver.find_element_by_xpath("/html/body/div[2]/join_form/button/div/ul/li").text, u"You are member, forget your password?") 
To escape this error I decided to write 4 assertion check at most and if any assertion left I have implement a new function for the related test cases. This solution is not wisely but as I search there is no solution about the problem just now. You can see the code and errors for demonstrating the situation below:


Popular posts from this blog

Testing WEB Sevices and Automating SOAP Services

Performance Testing on CI: Locust is running on Jenkins

Change Default Timeout and Wait Time of Capybara

Performance Testing on CI: Integration of Locust and Jenkins

Create an Alias for Interactive Console Work: Selenium and Capybara