Currently, the core targeting engine of Foxtrot best support the Internet Explorer browser. However, you might prefer or even need (are forced) to automate (part of) a process in the Google Chrome browser for any given reason. The functionality to enable the core targeting engine of Foxtrot to support the Google Chrome browser is currently underway, until then, there are alternative methods to perform automation in the Google Chrome browser. In this article, we will take a closer look at the most used method for automating browsers in general, which is using Python and the framework Selenium. Keep in mind throughout this article that the Selenium enables you to work in any major browser, therefore, you could potentially also use it to automate Firefox, Edge, etc.
To use the action, you have to install Python:
We also recommend that you install and set up PyCharm using the guide below if you have not already done so:
If you are looking for some general information and help to use the Python action in Foxtrot in general, you can read our guide:
With Python and PyCharm installed and set up, you are now equipped to get started with Selenium!
What to expect?
Of course, this approach is not as user-friendly as the normal drag-and-drop method of Foxtrot in Internet Explorer. This serves as an alternative to enable you to automate in other browsers, similar to how this article helps you to perform custom actions in Internet Explorer using VBScript. However, you should know that after getting over the first "learning-hurdle", using Python with Selenium in Foxtrot is actually not that hard to master and you will quickly discover the many abilities you unlock, enabling you to do tons of amazing things. So, buckle up and get ready for an exciting learning curve!
Install Selenium
With Python installed, you are now ready to install the Selenium framework. The Selenium framework enables you to automate tasks in all the bigger browsers, not only Google Chrome, but you could also do it in, for example, Firefox.
To get started, we recommend that you create a new project in PyCharm to learn and test Selenium. Then, when you have managed to get it working and understand the concept, you can start to implement actions in Foxtrot. So, we will begin this guide in PyCharm by creating a new project called "Selenium". Make sure to select the option "Existing interpreter" as we will install Selenium in a moment and we need this to be installed in the global Python interpreter to make sure that Foxtrot can also make use of the framework.
When that is done, before we start to write our code, we need to install Selenium. You can do that using pip as explained in this article:
Here, we simply go to the terminal of PyCharm and write "pip install selenium" and press enter:
If everything goes accordingly, you should see something like this:
Perfect, that means that Selenium is now installed and related to your Python interpreter. This also means that when we go to Foxtrot later and use Selenium there, it will work as well.
Install Webdriver
Before we can use Selenium successfully, we need to install the appropriate webdriver for the browser that we will be using. For this article, we will focus on Google Chrome but as mentioned previously, you can also automate browsers like Firefox using Selenium. On the Selenium website, there is a full list of all webdrivers:
To find the Google Chrome webdriver, scroll down to about the middle of the page and click the link. To help you, this should be the link to downloading the Google Chrome webdriver:
You have to download the webdriver that matches your version of the browser. To find your current Google Crome version, click in the top-right corner of the browser:
Here you will see your version of the Google Chrome browser.
So, on the download page for the webdriver, you simply have to find the matching version like this, which will typically simply be the latest stable release.
Make sure to select the Windows version of the driver.
After download, simply extract the files anywhere on your PC.
Now, the "chromedriver.exe" file you will use a lot, therefore, we recommend making it easily available for you in the future, for example, by creating a folder directly on the C: drive called "Selenium" and then place the file there like this.
Okay, perfect, we are now done setting up Selenium and can get started automating!
Getting started with Selenium
Please reference the sample project at the end of the article "Selenium - Google Example" for all the following learnings on how to get started with Selenium.
To first get started learning Selenium, we recommend that you create a new Python file in your created PyCharm project where you can start testing the Selenium framework before heading in to Foxtrot. You can call your new file anything you would like, it is simply for testing purposes.
After creating the file, it is time to learn the basics of Selenium. First, we need to import what we need from the Selenium package, so, your first line should be:
from selenium import webdriver
Hereafter, it is time to define the browser that you need to work with. For this article, it will be Google Chrome and you will need to specify the path of the webdriver like this:
browser = webdriver.Chrome(executable_path=r'C:\Selenium\chromedriver.exe')
This line will start a new instance of Google Chrome. Later in the guide, you will learn how you can also connect to an already opened window of Google Chrome, however, that is a bit more advanced. Now, just for the sake of the example, let us add a third line that navigates to the Google website:
browser.get('https://www.google.com/')
So the full code would look like this:
Let us try to run this! The first time you run the file, you need to go under "Run" to click on "Run...".
And then select the file you wish to run.
If everything works correctly, your code should open a new window of Google Chrome and navigate to the Google website.
IMPORTANT: There is something very important that you need to be aware of at this stage! Whenever you run the code above and all the following examples, you are starting a new instance of the Google Chrome webdriver. But, in the code, we do not close/quit/dispose this webdriver process. That is something you will learn at the end of this example exercise. So, please make sure to check your task manager and manually kill the process after each test run. The reason we do not include this in our code until the very end is because the appropriate way of doing so depends on your process. For example, using the in-built ".close()" and ".quit()" functions will close down the Google Chrome window, so you will not be able to see the output of the script you just executed. So, for now, please make sure to keep track of this manually and kill the process through the Task Manager.
Now, just for the purpose of illustrating and example, let us write some code that writes some value to the search field, clicks to search, and retrieves the text explaining the total number of search results. This will teach you some basic commands. To figure out how to write to the search bar in the site, you can right-click on the element and select "Inspect".
This will give you all the details about this element, enabling you to write some code to find the element and engage with it. Sometimes you might need to right-click and select "Inspect" twice on the element to get the actual element - we have seen that some users experience that it highlights the whole website instead of the exact element the first time they select to inspect.
Now, if you are not familiar with browser automation at all, this might seem a bit overwhelming and complicated. It can be, but in most cases it is actually very easy as soon as you get a hang of it. There are many different guides and resources on how to use Selenium in general and how to find elements. We definitely recommend that you research yourself to find your favorite articles or YouTube channel to explain the different concepts. Here are two websites that give some great explanation on how to use different methods to find elements on a website using Selenium:
- https://selenium-python.readthedocs.io/locating-elements.html
- https://chercher.tech/python/webelement-locator
As also explained in above guides, there are a number of different methods to find the element on the page. A great tip is to use the CSS Selector because you can simply copy all you need directly from the inspector and paste it into your code. Now, keep in mind, this might not be the best option for you, but it is great to now that it is possible. Simply right-click on the element to copy the selector.
Now, in your code, you can simply paste the stuff you copied directly in your code in the parentheses, remember to add the surrounding '' to make it a string:
browser.find_element_by_css_selector('#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input')
That is going to find the textbox but not actually do anything with the textbox. In order to write something in the textbox, we simply append:
.send_keys('Whatever you want to write...')
So let us say that we wish to search for "How To Python Foxtrot", then the line of code would be:
browser.find_element_by_css_selector('#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input').send_keys('How To Python Foxtrot')
At this point, you code should look like this:
Try to close down Chrome and rerun the Python code. Your result should be something like this.
Now, just to show you how you could use the keyboard to press enter instead of clicking the button to search, here is how you would do that. The Selenium package offers some "Keys" options. To utilize them, you need to import them first. So, at the top of the script below the first import line, add this line of code:
from selenium.webdriver.common.keys import Keys
Then, you could use that to send keys like hitting "Enter" like this (notice what we added to the end of the line of code):
browser.find_element_by_css_selector('#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input').send_keys('How To Python Foxtrot' + Keys.ENTER)
The full code would look like this:
Instead of hitting the "Enter" key, let us tab instead so that we are tabbed out of the textbox and then use a click to click on the search button. So, we adjust line number 7 to this:
browser.find_element_by_css_selector('#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input').send_keys('How to Python Foxtrot' + Keys.TAB)
Then, we do exactly the same with the search button like we did with the textbox in order to find the information to find the element.
IMPORTANT: Again, keep in mind, you can use any method you prefer or need in order to sufficiently find the element on the website.
First, we inspect the element.
Then, we copy the CSS Selector information.
And we add a new line to our code like this (notice the "click.()" at the end):
browser.find_element_by_css_selector('#tsf > div:nth-child(2) > div > div.FPdoLc.VlcLAe > center > input[type="submit"]:nth-child(1)').click()
This is how the code would look.
If we run the code, the result should be the same as before when using the "Enter" key. So, the result of running the code should be something like this, and let us say we would like to retrieve the information text about the search result.
Now, before we consider how to retrieve the text, we need to also consider "waiting". Just like you are used to in Foxtrot, we need to consider whether we should implement some sort of logic to make sure that our code waits until the page is loaded before it continues. This is very important to avoid errors. You may read about this in more details in other resources, for example, this one:
Shortly explained, you can either set a global wait in the beginning of your code:
browser.implicitly_wait(10) # Will set the global wait to 10 seconds.
Or you can explicitly wait for an element to be, for example, visible. For example, if we wanted to wait for the textbox in the Google website to be visible before we proceeded, we could implement this in our current code. Our full code would look like this after implementing it:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
browser = webdriver.Chrome(executable_path=r'C:\Selenium\chromedriver.exe')
browser.get('https://www.google.com/')
wait = WebDriverWait(browser, 10)
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input')))
browser.find_element_by_css_selector('#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input').send_keys('How to Python Foxtrot' + Keys.TAB)
browser.find_element_by_css_selector('#tsf > div:nth-child(2) > div > div.FPdoLc.VlcLAe > center > input[type="submit"]:nth-child(1)').click()
This waits up to 10 seconds before throwing a TimeoutException unless it finds the element to return within 10 seconds. WebDriverWait by default calls the ExpectedCondition every 500 milliseconds until it returns successfully. A successful return is for ExpectedCondition type is Boolean return true or not null return value for all other ExpectedCondition types.
The full code would look like this.
So, we can simply implement the same logic for the text that we will be looking for on the search result page to make sure that the element is present before we move on. First, we retrieve the information from the element to be able to find it. Now, instead of using the CSS Selector like we have done so far, let us use a different identifier. This is only something we do to show you some different methods. It is up to you to decide which method you will use. Using the CSS Selector is quite easy as you can copy-paste like we did previously, however, you would probably use different methods more often once you get more experienced. Let us try to use element ID this time. Again, we always start by inspecting the element.
Here, notice how you can see the ID of the element clearly.
To find the element using the ID, we simply write:
browser.find_element_by_id('resultStats')
So, to wait for the result stats to appear after clicking search, we would need to add:
wait.until(EC.presence_of_element_located((By.ID, 'resultStats')))
Our objective with this element is to retrieve the text, in other words, read the data. Let us store the text in a variable and then print it to the terminal. In order to do that, we write these two lines of code:
result_stats = browser.find_element_by_id('resultStats').text
print(result_stats)
Our full code at this point is:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
browser = webdriver.Chrome(executable_path=r'C:\Selenium\chromedriver.exe')
browser.get('https://www.google.com/')
wait = WebDriverWait(browser, 10)
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input')))
browser.find_element_by_css_selector('#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input').send_keys('How to Python Foxtrot' + Keys.TAB)
browser.find_element_by_css_selector('#tsf > div:nth-child(2) > div > div.FPdoLc.VlcLAe > center > input[type="submit"]:nth-child(1)').click()
wait.until(EC.presence_of_element_located((By.ID, 'resultStats')))
result_stats = browser.find_element_by_id('resultStats').text
print(result_stats)
Try to close down Google Chrome and run the code again. If everything works properly, you should get the output, the result stats, in the terminal:
Amazing! That is our first simple script using Selenium. It is now time to test whether this will work using Foxtrot. First, open Foxtrot and start a new project. In the project, go under Advanced in the action list and select the Python action. Simply copy-paste all your code from PyCharm into the Foxtrot action. Make sure to create a variable to store the output of the execution. Remember, all print statements will be stored in the output variable.
Now, run the action. If everything works properly, it should do exactly the same as before when running it through PyCharm, and you should see the output in your output variable.
Closing & Quitting the webdriver process
You have to make sure to properly close or quit your webdriver process to avoid memory leak and other problems. To make this easy, Selenium offers two functions to handle this:
- .close()
- .quit()
Any (or both) of the two should be included at the end of your code. Which of the two to use depends on your situation. You can read more about the two functions in other resources, for example, the two below articles - both of them use the word "driver" where we so far have used "browser":
- https://artoftesting.com/automationTesting/difference-between-driver-close-and-driver-quit-command-in-selenium-webdriver.html
- https://www.zyxware.com/articles/5552/what-is-close-and-quit-commands-in-selenium-webdriver
IMPORTANT: In the following section, you will learn how to connect your webdriver to a "manually" (not by your code, instead, for example, by Foxtrot) opened Google Chrome instance. If your code did not open the instance, the window, of Google Chrome, the ".quit()" function will not close the window, only terminate the webdriver process. That is actually a very good thing, because in most cases, you want to be able to terminate the webdriver process (to avoid memory leaks) but not necessarily the Google Chrome window. If you want to close the window, you should first have a line calling the ".close()" function and then a line calling the ".quit()" function.
Connecting to opened windows of Google Chrome
So far, we have made a small script that opens a new instance of Google Chrome every time it is executed. But, in some cases, you need to be able to connect to an already running instance of Google Chrome. For example, if you wish to use the Open App in Foxtrot to open Google Chrome, then have a series of different Python actions to perform different things, then you need to be able to continuesly engage with the same opened instance of Google Chrome. This is especially useful if you need manual engagement at any point in the process. So, how do we do this? It is not possible for any piece of code to connect to a normal instance of Google Chrome as you need declare that you wish to allow code to connect to the window. Let us have a look, it is actually very easy.
Before we proceed, disable the current action in Foxtrot to make room for the new logic we will implement.
Now, let us say that we wish Foxtrot to use the Open App action wish Google Chrome, then we need the Python code to connect to that window to perform the rest of the code we have already written. This way, you will be able to see the difference between code that always opens a new window and code that connects to an opened window.
To open Google Chrome, you can simply use the normal Open App (drag-and-drop to Google Chrome). You need to add two parameters in the options field:
- Declare that it is in "Debugging mode" and the port
- Declare the path to the profile to make sure you are running using a dedicated automation profile
--remote-debugging-port=8080 --user-data-dir="C:\Selenium\AutomationProfile"
Notice that the path declared here is the same as where we have the Google Chrome webdriver file. We recommend that you do that to have everything in the same folder. We also make sure to select "Launch again" as you will typically have your own personal Google Chrome window open while you are testing and running this.
Now, in your code, you need to include another important statement:
from selenium.webdriver.chrome.options import Options
And this is the code to connect to the opened window of Google Chrome:
chrome_options = Options()
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:8080")
chrome_driver = r'C:\Selenium\chromedriver.exe'
browser = webdriver.Chrome(chrome_driver, options=chrome_options)
So, if you copy your existing Python action to make a new one, this should be the code in the new action (you can also play with this in PyCharm first to get a hang of it before going back to Foxtrot):
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:8080")
chrome_driver = r'C:\Selenium\chromedriver.exe'
browser = webdriver.Chrome(chrome_driver, options=chrome_options)
browser.get('https://www.google.com/')
wait = WebDriverWait(browser, 10)
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input')))
browser.find_element_by_css_selector('#tsf > div:nth-child(2) > div > div.RNNXgb > div > div.a4bIc > input').send_keys('How to Python Foxtrot' + Keys.TAB)
browser.find_element_by_css_selector('#tsf > div:nth-child(2) > div > div.FPdoLc.VlcLAe > center > input[type="submit"]:nth-child(1)').click()
wait.until(EC.presence_of_element_located((By.ID, 'resultStats')))
result_stats = browser.find_element_by_id('resultStats').text
print(result_stats)
browser.quit()
Your Foxtrot should look like this:
If you run the Foxtrot project, it should first open Google Chrome with the Open App action, then the Python action should go to the Google website and perform the steps, ultimately giving the same end result.
And that is how you connect to an already opened window of Google Chrome! Download the sample project at the end of the article "Selenium - Google Example" to see the code for this plus how you can use variables to easier maintain your code.
"Full" project examples
Now, just to offer you a bigger example, let us take a look at a full project using Python Selenium to automate a process in Foxtrot.
FDIC website
You may find this project familiar, it is the same project that you learn to automate in the last part of the Academy Intro Course v14. This project will:
- Open an Excel spreadsheet from your downloads folder
- Loop through the states in the spreadsheet to
- Look up the state on the FDIC website to retrieve the total number of instituions
- Write the total number of institutions back in the Excel spreadsheet
First, take a look at the attached project "Selenium - FDIC, similar" at the end of the article. This sample project illustrates that you can implement and use the Selenium functionality to execute single steps of actions in your Google Chrome browser, meaning that the script will look very similar to other "normal" Foxtrot projects working in Internet Explorer. However, this might not necessarily be the best approach as it is quite slow since every single Python action needs to connect and disconnect the webdriver to the opened window of Google Chrome.
Secondly, take a look at the below code. This is an example of how this process could be fully automated via code using Selenium. To use this project, you need to also perform a pip install for the package "xlwings" that is a popular package to enable Python to read and write data to Excel. This is a bit more complicated as the whole flow of the project is written in code, however, it executes much faster and is arguably also more reliably.
IMPORTANT: Remember to change the folder path value.
# === Import all packages ===
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import datetime
import xlwings as xw
# === Open Excel document and load the data ===
folder = r'C:\Users\mbalslow\Downloads'
wb = xw.Book(folder + '\Website FDIC.xlsx')
sheet = wb.sheets[0]
states = sheet.range('A1:A' + str(sheet.api.UsedRange.Rows.Count)).value
wb.close()
# === Create new Excel workbook ===
wb = xw.Book()
sheet = wb.sheets[0]
sheet.range('A1').value = 'State'
sheet.range('B1').value = 'Number of Institutions'
# === Open Google Chrome ===
browser = webdriver.Chrome(executable_path=r'C:\Selenium\chromedriver.exe')
browser.get('https://www5.fdic.gov/idasp/advSearchLanding.asp')
# === Loop for each state ===
for index, state in enumerate(states):
row = index + 2
browser.switch_to.frame('content')
wait = WebDriverWait(browser, 10)
wait.until(EC.presence_of_element_located((By.ID, 'in_bank_state')))
select = Select(browser.find_element_by_id('in_bank_state'))
try:
select.select_by_visible_text(state)
except:
sheet.range('A' + str(row)).value = state
sheet.range('B' + str(row)).value = 'Error - State not found!'
browser.get('https://www5.fdic.gov/idasp/advSearchLanding.asp')
continue
while True:
try:
browser.find_element_by_id('btnSearch').click()
break
except:
browser.get('https://www5.fdic.gov/idasp/advSearchLanding.asp')
browser.switch_to.frame('content')
wait.until(EC.presence_of_element_located((By.ID, 'in_bank_state')))
select = Select(browser.find_element_by_id('in_bank_state'))
select.select_by_visible_text(state)
text = browser.find_element_by_id('divResultTable_info').text
text = text[text.find(' of')+len(' of'):text.rfind(' Institutions')]
sheet.range('A' + str(row)).value = state
sheet.range('B' + str(row)).value = text
browser.get('https://www5.fdic.gov/idasp/advSearchLanding.asp')
now = datetime.datetime.now().strftime('%Y%m%d')
wb.save(folder + '\Institutions ' + now + '.xlsx')
wb.close()
browser.quit()
Google Website (Look up city weather)
Here is another example simply to offer some more inspiration. This code loops through some cities to look up their weather on Google. Instead of writing to Excel, this solution gives the output in a text (.txt) format just for the sake of the example. Please find the project for this solution in the attached file below "Selenium - Google Weather.fox"
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import datetime
browser = webdriver.Chrome(executable_path=r'C:\Selenium\chromedriver.exe')
browser.implicitly_wait(10)
file = open(r'C:\Weather.txt', "w+")
file.write('Time|City|Temperature|Hot/Cold\n')
cities = ['Barcelona', 'London', 'Mexico', 'Sri Lanka']
for index, city in enumerate(cities):
browser.get("https://google.dk")
browser.find_element_by_name("q").send_keys(city + ' weather' + Keys.ENTER)
temperature = browser.find_element_by_class_name("wob_t").text
now = str(datetime.datetime.now())
weather = "Hot" if int(temperature) >= 20 else "Cold"
text = now + '|' + city + '|' + temperature + '|' + weather + '\n'
file.write(text)
browser.close()
browser.quit()
file.close()
The cool thing in this example is that we write the data to a text file that we then import in Foxtrot using the Open List action.
And this is the output.
Currency web table example
This example will open a bank website on their page with currency rate information displayed in two tables. You can get the example in the file "Selenium - Nationalbanken Currencies". The code will open up the application, find all the tables to iterate through them to extract all the data and write it to a CSV file in your downloads directory. Just like with the above example, of course, you could then load the data into a list in Foxtrot using Open List.
from selenium import webdriver
from selenium.webdriver.common.by import By
import csv
browser = webdriver.Chrome(executable_path=r'C:\Selenium\chromedriver.exe')
browser.get('http://www.nationalbanken.dk/valutakurser')
tables = browser.find_elements_by_id('currenciesTable')
with open(r'currencies.csv', mode='w', newline='') as file:
file_writer = csv.writer(file, delimiter=';', quotechar='"', quoting=csv.QUOTE_MINIMAL)
for table_index, table in enumerate(tables):
rows = table.find_elements(By.TAG_NAME, "tr")
for row_index, row in enumerate(rows):
row_text = []
tag_name = 'th' if row_index is 0 else 'td'
columns = row.find_elements(By.TAG_NAME, tag_name)
for index_column, column in enumerate(columns):
row_text.append(column.text)
if index_column == 3:
break
file_writer.writerow(row_text)
browser.close()
And the output (you would obviously delete row number 9 before further processing):
If you would like to use the Pandas package for this case, you could do so using below code:
from selenium import webdriver
import pandas as pd
driver = webdriver.Chrome(executable_path=r'C:\Selenium\chromedriver.exe')
driver.get('http://www.nationalbanken.dk/valutakurser')
tables = driver.find_elements_by_id('currenciesTable')
for index, table in enumerate(tables):
df = pd.read_html(table.get_attribute('outerHTML'), thousands='.', decimal=",")[0]
df = df.drop(["Se graf", "RSS", "Download"], axis=1)
if index == 0:
df.to_csv('C:/table_data2.csv', sep=";", decimal=",", index=False)
else:
df.to_csv('C:/table_data2.csv', sep=";", decimal=",", index=False, mode='a', header=False)
driver.close()
Comments
7 comments
Hi Mathias
Is there any way of using Foxtrot with Python actions in Chrome, when Chrome has been opened via a "link" rather than via Foxtrot. I have an example where a user is in an ERP system, and clicks a link, this link will open up a table in a website. The preferred browser will always be used, and as this is Chrome and not IE, we cannot have Foxtrot working in this table. I would like to be able to get the table imported into foxtrot.
Hi Ghita Maria Fjorback,
Unfortunately, this is not possible what you describe, if I understand you correctly. For Python (Selenium) to be able to connect and hereby automate in Chrome, you need to know the port number and user profile path. So you will have to have Foxtrot or the user open Chrome setting this as explained in the article (https://support.foxtrotalliance.com/hc/article_attachments/360025684172/2019-04-07_09-59-23.png) for it to work.
Could it be possible for the user instead of clicking the link that they simply copy the link, then you could have your script start with a value in the Windows Clipboard defining the target URL. Then you can use the value to open the link in either IE or Chrome.
Hi Mathias
No, unfortunately there is no link to copy. It is actually not a "link" that is clicked, this was wrongly explained by me. It is the customs system of Toldstyrelsen in Denmark. In this system, you can put in the reference of a custom clearance, and once you want to check the status of the reference, a webpage is automatically opened. The browser will be your preferred browser always.
Hi Ghita Maria Fjorback,
Could you then have Foxtrot grab the URL of the opened Google Chrome window to then open a new window via either IE or Chrome where Foxtrot is connected to the browser and then do whatever needs to be done?
I Mathias
I guess I can, by the help of a Python action to find the address line and copy the value. I will have to test this next time I am with the client.
Ghita
Hi Ghita Maria Fjorback,
Just target the whole Chrome window with Foxtrot, then use a Send Value action with:
hehe, yes, that was a lot easier. I am quite sure my client does not have IE at all anymore, as their IT has decided this is no longer part of the software the company want, but the link copied would then be possible to use with this article theme! Thanks a million.
Please sign in to leave a comment.