Exploring Web Automation with Dynamic Code

Prerequisites

Approach

  • The first file initializes the driver, does some initial setup (e.g. navigating to the page) and then starts the polling loop that automatically loads and executes dynamic code.
  • The second file contains code that gets executed automatically whenever the file changes (usually when the user saves it).

Main File

Dynamic File

  • Access any variables defined in the main file (including “driver” which gives access to the Selenium driver)
  • Define new variables that will persist between invocations
if not ('main_window_handle' in vars() 
or 'main_window_handle' in globals()):
print('main_window_handle is not defined')

--

--

--

Write code for fun and living

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What I Learned After Interning as a Full-Stack Developer

My Journey into Tech

Using Scrum for “Agile” Software Development

Self Sufficient Precision Agriculture Management for Irrigation

Build a countdown popup in minutes with Magezon Magento 2 Popup Builder

Predictions/Goals: Past and Future

Some of my favourite tools when working with software engineers…

Terraform — Deploy AWS Inspector A cloud-based Vulnerability Assessment Tools

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
David Air

David Air

Write code for fun and living

More from Medium

Automating Instagram login using Python | TheCodingNeuron

Decorators

Setup Apache Hadoop on local Ubuntu System

5 Advantages of Using Python for Artificial Intelligence