Functional Tests failing on Jenkins but not on local computer

Ever struggled with a test failing on jenkins using xvfb, well there are a few things you can do to ensure that both browsers work.

Element Not Found

Sometimes there is an ElementNotFound error on the server and not on your local. Usually this is because selenium cannot see the element. It is hidden.

Usually this happens when both screens you test on are not the same size. So you want to ensure that both screens are the same size.

Solution Maintaining Consistency

Set the Window Size

In your setUp for the tests, ensure you resize the browser screen to a single size.

self.browser = webdriver.Firefox()
self.browser.set_window_size(1280, 800)

Set XVFB Screen size same as local

Set the screen size to the same as your local