Category: selenium

Wait For Elements In Python Selenium (5 Powerful Examples)

Alright, welcome back to the blog, Roberts Greibers here, and in this post, I want to talk about five powerful examples you can use in Python Selenium to wait for elements when working on automation projects.

Whether you’re just getting started as a Python developer, or you are already in the industry as a test automation engineer and looking for more effective ways in Python selenium to wait for element – this post is for you!

These are not just things that I’ve just randomly come up with!

These are not just theoretical concepts!

These are code examples in Python selenium to wait for element that I have saved in my notes since a long time ago and I literally used them back when I used to work on test automation projects. 

The code examples I’m about to show you are few of the best ways in Python selenium to wait for element that allowed me to improve the speed of my test automation scripts!

I’m going to show you a code to:

  • wait for element to be found (any situation)
  • wait for element to be visible
  • wait for element to be clickable
  • wait for element to load
  • wait for element to be displayed

… which one to use depends on a specific situation you’re working on. But I can assure you, in the end, these code examples led me to write more advanced Selenium automation test cases. 

And NO! It’s not going to be about using just the typical time.sleep(1) solution. I’ll show you where it’s appropriate to use time.sleep(1) and I’ll show you the best ways I know in Python Selenium to wait for element.

import time

time.sleep(1)

I’ve been working professionally as a Python developer for more than 5 years – a part of it was as a quality assurance engineer where I worked with Python and selenium framework a lot. 

Eventually, I became a Python/Django developer (see my Linkedin here) and now I’m also helping relatively new engineers (quality assurance engineers, analysts, etc.) to become Python developers. (see a cut from a LIVE mentoring call)

If you like the idea of becoming a Python developer, learning about Selenium framework tricks, and eventually maybe even becoming a Django developer, then this post is for you!

Continue reading

Amazon Scraping In Python Selenium

Scraping data from any kind of website with Python can be exciting and challenging at the same time. Also, you can learn a lot about development and writing simple scripts – practice Python’s fundamentals.

More than 5 years ago, when I first started to get to know what Python is capable of – the very first thing I wanted to learn was how to automate browser actions – open websites, click on buttons, enter text into input fields, etc.

Back then I was learning how to automate facebook.com

Within the following steps, you will learn how to automate scraping data from amazon.com from A-Z.

I’ve prepared steps with everything you need to do in order to be able to fully automate the process and gather data for up to 100 products in less than a minute.

With the provided code you’ll have a good base for starting the Amazon website automation and you’ll be able to expand and extend my code to whatever your goals are.

Follow the steps below.

Continue reading