Trying to click "OK" on a pop up using a webbot script in order to pull down a file from a website. On one machine the following code worked:
from webbot import Browser
import time
import keyboard
import threading
def push_ok_button():
keyboard.press_and_release('enter')
class CustomThread(threading.Thread):
def init(self, function, start_delay_seconds=None):
threading.Thread.init(self)
self.function = function
self.start_delay_seconds = start_delay_seconds
def run(self):
if self.slart_delay_seconds:
time.sleep(self.start_delay_seconds)
self.function()
push_ok_thread = CustomThread(push_ok_button, start_delay_seconds=5)
push_ok_thread.start()
web = Browswer()
push_ok_thread.join()
web.go_to('website.com')
On my machine I rec'd the following error:
TypeError:___init___() got an unexpected keyword argument 'start_delay_seconds'
I've also tried web.click('enter') and web.click('OK') but those fail as well.
Daraan commented above that I needed to add underscores on either side of my init, now the "OK" button is pressed.