I have a python script that uses selenium to go to the bottom of a web page, www.tradingview.com/screener. Once it's at the bottom of the page, I need to use an auto it script I made to click on a save button. Both the python script and the auto it script are working separately but I'm trying to call the auto it script from the python script. I thought it might be as simple as putting an include line in the python script to call the auto it script but it's not working. Does anyone know how to accomplish this? I'll put both scripts below. Thanks
Python Script to go to the bottom of the web page.
from time import sleep
from selenium import webdriver
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.common.exceptions import TimeoutException
url = 'http://www.tradingview.com/screener'
driver = webdriver.Firefox()
driver.get(url)
try:
selector = '.js-field-total.tv-screener-table__field-value--total'
condition = EC.visibility_of_element_located((By.CSS_SELECTOR, selector))
matches = WebDriverWait(driver, 10).until(condition)
matches = int(matches.text.split()[0])
except (TimeoutException, Exception):
print ('Problem finding matches, setting default...')
matches = 4895 # Set default
# The page loads 150 rows at a time; divide matches by
# 150 to determine the number of times we need to scroll;
# add 5 extra scrolls just to be sure
num_loops = int(matches / 150 + 5)
for _ in range(num_loops):
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
sleep(1) # Pause briefly to allow loading time
Auto It script to click a save button.
; Script Start - Add your code below here
ShellExecute("https://www.tradingview.com/screener")
#include <Vince.au3>
Sleep(4000)
Send("{END 20}") ; Presses the DEL key 4 times
MouseClick($MOUSE_CLICK_LEFT, 2460, 46, 1)
Sleep(7000)
Send("{ENTER}") ; Presses the DEL key 4 times