Splunk AppDynamics

Synthetic jobs

João_Pirovics
Engager

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? 

Labels (1)
0 Karma

Arpit_Bhushan_S
Engager

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.

iamryan
Community Manager
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. 

0 Karma

João_Pirovics
Engager

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

Tags (1)
0 Karma

iamryan
Community Manager
Community Manager

Hi @João.Pirovics,

Does the site have a popup window that shows up that could be interfering with the script?

0 Karma

João_Pirovics
Engager

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!

Tags (1)
0 Karma

iamryan
Community Manager
Community Manager

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.

Get Updates on the Splunk Community!

Splunk Observability Synthetic Monitoring - Resolved Incident on Detector Alerts

We’ve discovered a bug that affected the auto-clear of Synthetic Detectors in the Splunk Synthetic Monitoring ...

Video | Tom’s Smartness Journey Continues

Remember Splunk Community member Tom Kopchak? If you caught the first episode of our Smartness interview ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud? Learn how unique features like ...