this is my code: def findandclickbutton(driver, team1, team2, buttonstring): """ Find…
Jump to turn (9)
- 1this is my code: def findandclickbutton(driver, team1, team2, buttonstring): """
- 2C:\Users\roiy0\PycharmProjects\arbitrage-betting\venv\Scripts\python.exe C:\User
- 3it is probably not wait time related, maybe try another approach to the mission
- 4Traceback (most recent call last): File "C:\Users\roiy0\PycharmProjects\arbitrag
- 5Error: Message: Stacktrace: RemoteError@chrome://remote/content/shared/RemoteErr
- 6Error: Message: Stacktrace: RemoteError@chrome://remote/content/shared/RemoteErr
- 7C:\Users\roiy0\PycharmProjects\arbitrage-betting\venv\Scripts\python.exe C:\User
- 8but I need the code to be fully automatic, maybe let a bot scroll down the page
- 9try a computer vision approach
- User
this is my code: def find_and_click_button(driver, team_1, team_2, button_string): """ Find the button that contains team_1, team_2, and button_string and click it.
codeArgs: driver: Selenium webdriver instance. team_1: String of the first team name. team_2: String of the second team name. button_string: String to be contained within the button text. Returns: Boolean value. Returns True if the button was found and clicked successfully, otherwise returns False. """ # Wait until the element is loaded element = WebDriverWait(driver, 10).until( EC.presence_of_element_located((By.CLASS_NAME, 'cw-e-sports-market')) ) # Find the button that contains team_1, team_2, and button_string button = element.find_element(By.XPATH, f".//button[contains(., ‘{button_string}’) and contains(., ‘{team_1}’) and contains(., ‘{team_2}’)]") # Check if the button was found successfully if button: button.click() return True else: return False