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

Querying the MEME contract with the Covalent API and Python.

Starting an Azure Container from an Azure Function using C#

Decentralized Value Proposition Canvas — DPC

Let’s Deploy Azure Stack (Hub) Development Kit

Why Programming Is Hard.

PMPeople: The tool for the Agile PMO

Tech Sharing — JS Sort Visualization

RO:Mong Preview#1

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

Are you still using SQL ‘LIKE’?

Creating a MySQL Database Using the IQAir API & Python

Building a Twitter clone-Part 1(setup)

DATABASE IN PYTHON