Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
05-31-2022 02:31 PM
I have created a job to login on a specific web page, it runs perfectly on my local machine, although when I set this job to run on appdynamics synthetic jobs I got an error. Sometimes I receive a timeout error and sometimes I got a "Unable to locate element". I have already tried different timeout periods and many types of element selectors (xpath, css selector, ID ...), locally every selector works fine, the problem happens every time I try to run it on appdynamics...whatelse should I try?
06-01-2022 08:26 AM
Hi @João.Pirovics,
I did some searching and it seems there are quite a few reasons this error may show up. Can you share more of the error logs?
Note: Be sure to scrub the logs of any private or security-related data before posting.
Thanks,
Ryan, Cisco AppDynamics Community Manager
Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.
Check out Observabiity in Action
new deep dive videos weekly in the Knowledge Base.
06-02-2022 12:06 PM
Hi, @Ryan.Paredez ,
Thank you for helping me with this issue.
The error message is this:
Line 19, in <synthetic script> agencia_input = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, agencia_input_css)))
Line 80, in until raise TimeoutException(message, screen, stacktrace)
When i try to run the code without the wait.until function I´m getting this error:
Line 20, in <synthetic script> agencia_input = driver.find_element(By.CSS_SELECTOR, agencia_input_css)
Line 976, in find_element return self.execute(Command.FIND_ELEMENT, {
Line 226, in intercept_execute return real_execute(driver_command, params)
Line 321, in execute self.error_handler.check_response(response)
Line 242, in check_response raise exception_class(message, screen, stacktrace)
I really can´t understand why the script runs without error locally but when appdynamics try to run it an error occours.
Here is my script:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
import time
pageUrl = "https://www.itau.com.br"
agencia_input_css = '#agencia'
conta_input_css = '#conta'
login_button_css = '#loginButton'
driver.maximize_window() #tried to maximize the window to see if it solves the problem
driver.get(pageUrl)
time.sleep(5)
wait = WebDriverWait(driver, 10)
# driver.find_element(By.CSS_SELECTOR, agencia_input_css).send_keys("1234") I´ve tried this method without the wait.until to see if it works but still get an error
agencia_input = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, agencia_input_css)))
agencia_input.send_keys("1234")
# driver.find_element(By.CSS_SELECTOR, conta_input_css).send_keys("123456")
conta_input = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, conta_input_css)))
conta_input.send_keys("123456")
time.sleep(3)
# botao_login = driver.find_element(By.CSS_SELECTOR, login_button_css)
login_button = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, login_button_css)))
driver.execute_script("(arguments[0]).click();", login_button)
print("Título da página de destino :", driver.title)
print('Script concluído com sucesso!')
06-02-2022 12:36 PM
Hi @João.Pirovics,
Does the site have a popup window that shows up that could be interfering with the script?
Thanks,
Ryan, Cisco AppDynamics Community Manager
Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.
Check out Observabiity in Action
new deep dive videos weekly in the Knowledge Base.
06-02-2022 08:50 PM
Actually it has the "Accept cookies" popup.
I have just tried adding to the script some lines in order to click on "ok" and accept those cookies. The script can find and click on the popup button but still having the same problem when it tries to find the other elements.
For a moment I have had some hope that it would be the solution...hahaha
Thank you for the support!
06-06-2022 08:12 AM
Hi @João.Pirovics,
Ah, I thought that was going to do it too. Let me see what else I can find. I'll report back if I find another troubleshooting step.
If you happen to figure anything else out, please do share that back here.
Thanks,
Ryan, Cisco AppDynamics Community Manager
Found something helpful? Click the Accept as Solution button to help others find answers faster.
Liked something? Click the Thumbs Up button.
Check out Observabiity in Action
new deep dive videos weekly in the Knowledge Base.
07-15-2022 04:33 AM
Hi @João.Pirovics ,
The application is an SSO based application I guess and for automating the SSO based application, selenium-python don't have any other solution, because they are window authentication based applications. Either try to make a dummy user and make it login application(https://gist.github.com/ikegami-yukino/51b247080976cb41fe93) or make a single user have robotic id password and give it in AppD to make job work successful, I am sure it will work fine.
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form