Selenium (Python)


  • How is 'Selenium' pronounced?
    • A: It's named after the element, so it should be pronounced "sel-lee-nee-um", but the creator of the project mispronounces it as "sel-len-ee-um", and lots of people have adopted his pronunciation. (Source - Scroll to the bottom)



  • Selenium Python: how to wait until the page is loaded?
    • I should mention that the webdriver will wait for a page to load by default. It does not wait for loading inside frames and also for ajax requests. It means when you use .get('url'), your browser will wait until the page is completely loaded and then go to the next command in the code. But when you are posting an ajax request, webdriver does not wait and it's your responsibility to wait an appropriate amount of time for the page or a part of page to load; so there is a module named expected_conditions.

  • https://www.snaptest.io/



Tips

  • How to get info about an element:
    • element.get_attribute('outerHTML')  ← This is all of the HTML within the element, including the HTML for the element itself
    • element.get_attribute('innerHTML') ← This is all of the HTML within the element, excluding the HTML for the element itself.
    • element.text ← This will give you the visible text for an element(?)
    • element.get_attribute('any of the keys in the element's tag')