Open In App
Related Articles

How To Automate Google Chrome Using Foxtrot and Python

Improve Article
Save Article
Like Article

In this article, we are going to see how to automate google chrome using Foxtrot & Python.

What is Foxtrot RPA?

Robotic process automation (RPA) cuts down employees’ workloads by automating repetitive, high-volume steps in processes. Software robots, such as Foxtrot RPA emulate the actions of human workers to execute tasks within applications via their UI.

Prerequisites :

  • Install the latest version of Foxtrot RPA.
  • Install python selenium package by running the following command in terminal.
  • Install the latest Google Chrome and its Chrome webdriver.

We need to create a simple python script that automates a work in Google Chrome using selenium and chrome webdriver. And here, we will automate an authorization at “” and extract the Name, Email, Institute name from the logged-in profile.

First, we test it by running the python file and then we will add this python script in Foxtrot Python Actions Botflow and run the Botflow.

Extracting information using webdriver:

First, we need to initiate the webdriver using selenium and send a get request to the url, and then identify the HTML document and find the input tags and button tags which accept username/email, password, and sign in button.

To Send the user given email and password to the input tags respectively:


To Identify the button tag and click on it using the CSS selector via selenium webdriver:


After clicking on Sign in, a new page should be loaded containing the Name, Institute Name, and Email id.

Identify the tags containing the above data’s and select them:

container = driver.find_elements_by_css_selector(‘div.mdl-cell.mdl-cell–9-col.mdl-cell–12-col-phone.textBold’)

Get the text from each of these tags from the returned list of selected CSS selectors:

name = container[0].text
    institution = container[1].find_element_by_css_selector('a').text
    institution = container[1].text
email_id = container[2].text

Finally, print the output:

print({“Name”: name, “Institution”: institution, “Email ID”: email})

Below is the implementation:


# Import the required modules
from selenium import webdriver
import time
# Main Function
if __name__ == '__main__':
    # Provide the email and password
    email = ''
    password = ''
    options = webdriver.ChromeOptions()
    # Provide the path of chromedriver
    # present on your system.
    driver = webdriver.Chrome(
    driver.set_window_size(1920, 1080)
    # Send a get request to the url
    # Finds the input box by name
    # in DOM tree to send both
    # the provided email and password in it.
    # Find the signin button and click on it.
    # Returns the list of elements
    # having the following css selector.
    container = driver.find_elements_by_css_selector(
    # Extracts the text from name,
    # institution, email_id css selector.
    name = container[0].text
        institution = container[1].find_element_by_css_selector('a').text
        institution = container[1].text
    email_id = container[2].text
    # Output
    print({"Name": name, "Institution": institution,
           "Email ID": email})
    # Quits the driver


Automating the Script using Foxtrot

Here we are going to automate the script using foxtrot.

Step 1: Open Foxtrot App and make sure to select the Level as Expert in Account setting:

Step 2: Create a New Botflow and click on the Advanced tab in Actions Panel and select Python.

Step 3: A new window should appear where you can select the method as Code and copy-paste the previous script in the Code Box provided.

Or, you can select the method the python file containing the script:

Step 4: To show the output of the above script in Foxtrot, we need to create a variable. Click on the checkbox beside Save to and select the magic button on the right side.

Creating Variable

Step 5: A new window should appear called Expression, Select Variables in the Items and click on “+” button top right of the window.

Step 6: Provide a Name and select Type as Text and click OK.

Click OK again and then type the name of the variable in Save To Box. The below Image represents the final state after following the above-mentioned steps.

Click on OK to Run the BOT:

Step 7: To view the Output, Select Variables in the BotFlow and click on the pencil button of the previously selected variable.

The output is the same as we saw before while running the script on Terminal:

This is how we can automate Google Chrome by using Selenium, Python and Foxtrot.

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 14 Sep, 2021
Like Article
Save Article
Similar Reads
Related Tutorials