cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Synthetic jobs

João.Pirovics
Creator

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? 

6 REPLIES 6

Ryan.Paredez
Community Manager

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.

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!')

 

 

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.

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!

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.

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.

On-Demand Webinar
Discover new Splunk integrations and AI innovations for Cisco AppDynamics.


Register Now!

Observe and Explore
Dive into our Community Blog for the Latest Insights and Updates!


Read the blog here
Top Kudoed Authors