I have the following script:
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
import time
url = 'https://www.icribis.com/it/'
codes = [...] # my codes
driver = webdriver.Chrome()
wait = WebDriverWait(driver, 20)
driver.get(url)
time.sleep(0.5)
# Disable cookies
driver.execute_script('return document.querySelector("#usercentrics-root").shadowRoot.querySelector("#uc-center-container > div:nth-child(2) div > button:nth-child(3)")').click()
time.sleep(0.5)
for code in codes:
# Select Codice fiscale (= fiscal code)
wait.until(EC.element_to_be_clickable((By.XPATH, "//label[@for='search-type-fiscal-code']"))).click()
time.sleep(0.5)
# Clean the search bar
driver.find_element(by=By.ID, value='companySearchFormInput').clear()
time.sleep(0.5)
# Insert the fiscal code in the search bar
wait.until(EC.visibility_of_element_located((By.XPATH, "//input[@name='search']"))).send_keys(code)
time.sleep(0.5)
# Click on the button
wait.until(EC.visibility_of_element_located((By.XPATH, "//div[@id='companySearch']//input[@type='submit']"))).click()
time.sleep(0.5)
# Rest of the code
driver.close()
Is there a way in Selenium Python to do some of the above operations using the mouse?
For example, in the case of # Select Codice fiscale (= fiscal code)
, move the mouse up to go over the word "Codice fiscale" (in any point of it) and then click (select) it?
Thanks in advance for your clarifications.