I have a Selenium Python test to check a website is working effectively.
I tested this script multiple times on my local computer and it works just fine. But when I run it in Azure DevOps, it fails. Here is the scenario and where it does fail
When the page loads, the start and end date are shown in this format dd/mm/yyyy
, and the button Start Campaign
is greyed out until the correct date format is set (as you can see in the screenshot)
My Selenium code:
start_date = date.today()
# start Date
time.sleep(3)
el_start_date = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="root"]/div[2]/main/div[3]/div[1]/div[2]/input')))
time.sleep(5)
el_start_date.clear()
el_start_date.send_keys(start_date.day, Keys.ARROW_RIGHT, start_date.month, Keys.TAB * 2)
# End Date
end_date = start_date + timedelta(days=14)
time.sleep(5)
print(end_date)
el_end_date = wait.until(EC.element_to_be_clickable((By.XPATH, '//*[@id="root"]/div[2]/main/div[3]/div[1]/div[3]/input')))
el_end_date.clear()
el_end_date.send_keys(end_date.day, end_date.month,end_date.year)
Locally works just fine and it does input the correct date format and I am able to auto click the Start Campaign
, but in Azure DevOps pipeline, the script fails at this stage because it can't target the button, which makes me believe that something is going wrong with the date input format.
I tried everything to debug it but nothing works and I don't know how I can at least retrieve the value of those days to understand how to fix this issue.
Can please anyone help me to figure out this problem or how can I solve it and debug it?