Tag: python

AppRobotic Process Automation | RPA

How to force webpage to stop loading to click a button?

Sometimes, when automating a webpage with Selenium, a script on the page or another reason prevents the webpage from loading in a timely fashion, preventing Selenium from accessing its elements such as buttons that we’d like to interact with. In the code sample below, we solve this problem by replicating user interaction with the webpage…
Read more


0

How to run automation 24/7, but not on my computer?

Q: I wrote some RPA automation incorporating Selenium WebDriver. It visits various internal company webpages and checks for updated resources, such as white papers and forum posts. It refreshes every 5 minutes, and sends an alert email if a new resource is found. How can I run this RPA script 24/7 somewhere other than on…
Read more


0

How do I type/send keyboard keys with AppRobotic?

The Type() method in AppRobotic can be used to send keyboard strokes to the active element on the screen. Python Code: import win32com.client x = win32com.client.Dispatch(“AppRobotic.API”) x.Type(“This is a test.”) x.Type(“{TAB}”) x.Type(“This is another test.”) x.Type(“{ENTER}”)


0

How to read Excel file, loop through rows, and perform AppRobotic Actions for each row in Python?

How to read Excel file, loop through rows, and perform certain AppRobotic Action steps for each row in Python? Let’s say that we have 2 URLs in an Excel sheet (Sheet1). Cell A1 has a URL such as google.com and cell A2 also has a URL such as google.com. Below, we open a web browser,…
Read more


0

How to open Google in a web browser with Python and search using an AppRobotic macro?

AppRobotic can be used to create a simple macro to perform any action in a web browser. The code example below leverages Python to open a web browser window, and perform a simple search on Google. Python Code: import win32com.client x = win32com.client.Dispatch(“AppRobotic.API”) # specify URL url = “https://www.google.com” # open with Edge browser x.OpenURLEdge(url)…
Read more


0

How to click a webpage element only if it is found by Selenium?

To check whether an element was found on the page prior to trying to click it, we can read its length with the len() method. If it’s greater than 0, we proceed to click it. Python Code: import win32com.client x = win32com.client.Dispatch(“AppRobotic.API”) from selenium import webdriver # navigate to Yahoo driver = webdriver.Firefox() driver.get(‘https://www.yahoo.com’) #…
Read more


0

How to install win32com.client in Python?

If you’re seeing a ImportError: No module named win32com.client error while using the Python language with AppRobotic, it means that this module has somehow broken during an update process. Open a Command Prompt, change the directory to the 32-bit Python install directory, such as: cd “C:\Program Files (x86)\Python39-32” and run the following command: python -m…
Read more


0

How to scroll to a webpage element with Selenium?

Selenium provides the ‘move_to_element’ method that will scroll to the element in the DOM, and place the mouse on the element, which subsequently makes it easy to click: Python Code: import win32com.client x = win32com.client.Dispatch(“AppRobotic.API”) from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains # navigate to Instagram driver = webdriver.Firefox() driver.get(‘https://www.instagram.com’) # sleep 1 second…
Read more


0

How do I run Chrome with Selenium WebDriver in Python?

To launch Chrome with Selenium WebDriver, ensure that the path to your ChromeDriver binary download is listed in the Windows PATH environment variable. Alternatively, you can specify the path to ChromeDriver directly during runtime per the example below: Python Code: import win32com.client x = win32com.client.Dispatch(“AppRobotic.API”) import os from selenium import webdriver # assign ChromeDriver path…
Read more


0

How to download and save all images from a URL?

To download all images from a given website, we can iterate through all ‘img’ elements, and leverage the ‘urlretrieve’ method to save them to our computer. Sample code below: Python Code: import win32com.client x = win32com.client.Dispatch(“AppRobotic.API”) from selenium import webdriver import urllib.request # navigate to Instagram driver = webdriver.Firefox() driver.get(‘https://www.instagram.com’) # sleep 1 second x.Wait(1000)…
Read more


0

How to click a link with Selenium WebDriver using Python?

Clicking on a website link with Selenium WebDriver is a two-step process: 1) Locate the link element on the webpage 2) Click on the located link using Selenium’s ‘click’ method Python Code: import win32com.client x = win32com.client.Dispatch(“AppRobotic.API”) from selenium import webdriver # navigate to Yahoo driver = webdriver.Firefox() driver.get(‘https://www.yahoo.com’) # sleep 1 second x.Wait(1000) link…
Read more


0

How do I find a particular link on a page with Selenium and Python?

When searching for a particular link on a page, it’s easy to store the link elements in a List, and then loop through it until you find a match: Python Code import win32com.client x = win32com.client.Dispatch(“AppRobotic.API”) from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By # navigate to Yahoo driver = webdriver.Firefox()…
Read more


0

How to complete login forms on Instagram using Selenium WebDriver and Python?

While attempting to log into Instagram using Selenium the traditional way, if you’re unable to fill in the login fields, it’s necessary to make a couple of tweaks as the Login form is done in ReactJS. Python code for Selenium WebDriver leveraged with AppRobotic Personal Edition below:   Python Code: import win32com.client x = win32com.client.Dispatch(“AppRobotic.API”)…
Read more


0

How to accept security certificates while using Selenium?

To accept untrusted website security certificates while automating with Selenium, it’s possible to set a particular option on the driver that you’re using (Firefox, Chrome, IE). Most recently, this option is called ‘acceptInsecureCerts‘, however it doesn’t always work, particularly on newer versions of IE and Firefox. If you run into this issue with newer browser…
Read more


0