domingo, 1 de febrero de 2015

How to check if my website this ON?

With Selenium language, is very easy. Only need installed selenium python library.
Simple example using Selenium library
browser = webdriver.Firefox()
browser.get('http://google.es')
assert 'Google' in browser.title
In this example only checked if google.es has the "Google" title.

Now, if don't has the correct title the webs site, takes a screenshot.
browser = webdriver.Firefox()
browser.get('http://google.es')
if 'Google' not in browser.title:
    base64 = browser.get_screenshot_as_base64()
Finally, you can program tasks to check your websites and send email on error. If you want see the full example code go to this url Github/Endika/test_script/checkWebsite.py

No hay comentarios:

Publicar un comentario