fbpx
Save and reuse cookies with Selenium

Save and reuse cookies with Selenium

Suppose I want to create a Selenium script that logs into Facebook, I would first have to log in to Facebook by instructing Selenium to fill out the login form below However, instead of spending time to write code for the login ( fill in the form and click on Log in...
How to create a Python module

How to create a Python module

A Python module is a file or group of files that contain function definitions and statements. A module can be created by creating a .py file. For instance, we can create a file hello.py with the following code: def say_hello(): print(“Hello World!”) We can...
How to accept user input in Python

How to accept user input in Python

Python 3 has a built-in method for accepting user input. Let’s take a look at how to implement this. We want to accept two numbers from a user then return the product of both number1 = input(“What is the first number? “) number2 = input(“What...
Function to Sum two numbers with Python

Function to Sum two numbers with Python

The function below sums up two numbers with Python: def addition( a , b ): return a + b print( addition( 4, 5 ) ) print( addition( 2, 2.5 ) ) The function will work with integers and floats. If however the function is run with an integer and a string, the following...
Increment a variable in Bash

Increment a variable in Bash

Suppose you have a variable below how would you increment that variable by 1 in Bash x=0 You can use let x++ If we want to loop through a number of items while incrementing the x variable, we can use the for loop below: for name in Lisa Lilly Lousa ; do echo $x $name...