Knowledge Base

cancel
Showing results for 
Search instead for 
Did you mean: 

Synthetic Scripts FAQ (Part II)

 

Table of Contents:

See also Synthetic Scripts FAQ (Part I).

 

On-Premises/SaaS

 

What are the supported on-premises/SaaS/hybrid configurations?

Controller

Web/Mobile RUM

Synthetic

SaaS

SaaS

SaaS

On-Premises (4.5.4+)

On-Premises 

(4.5.4+)

On-Premises 

(4.5.4+)

 


 

Security/Passwords

 

Do you have an encrypted store for passwords?

Not at this time.

 

Are scripts and test results transferred securely?

The short answer is that scripts and their results always go over encrypted channels. The scripts and results are stored in clear text in various databases, so a database breach could compromise the information, but, of course, we try very hard to prevent database breaches.

 

For the long answer, see the summary of the data path of a script and its results below. (Foo) denotes data at rest.

  • Script -> UI -> Controller -> EUM SaaS services -> (EUM SaaS database) -> Test driver service.
  • Test driver service connects to PoP machine with an encrypted channel and sends WebDriver commands to the PoP, driving the browser.
  • The browser connects to a website and imitates a user. Instrumentation hook gathers data from browser and sends it to an EUM SaaS service. Now we have a test result.
  • Test result -> EUM SaaS service -> (metric store, event store, and EUM SaaS database) -> controller -> UI.

 

Each of the -> links uses HTTPS, with two possible exceptions which are determined by the user:

  1. If you use an on-prem controller, security between the browser and controller is your responsibility. In other words, don't allow non-HTTPS connections to your controller.
  2. Security between the test browser and your website is your responsibility. Consequently, your script should connect to your site over HTTPS.

 

How can I retrieve passwords from a secure server, not hard-code them in the script?

If you can write Python code to do something using the standard libraries, you can do that in your script. For example, you can use Python's requests library to make REST calls to fetch a password.

 


 

Selecting Elements

 

How do I click on an element in an iFrame (for instance to handle a pop-up)?

You can wait for the iFrame element to be clickable as shown in the snippet below.

from selenium.common.exceptions import TimeoutException
# Cancel an advert pop-up in an iframe
# Find the right iframe
frame = wait.until(EC.element_to_be_clickable((By.XPATH,'//xpath-to-your-iframe]')))
# Move into the iframe
driver.switch_to_frame(frame)
# Close the pop-up
wait.until(EC.element_to_be_clickable((By.XPATH,'/xpath-to-element/i'))).click()
# Move to the default content
driver.switch_to_default_content()

 


 

Snapshots

What is the retention period of snapshots?

Two weeks.

 

Can the retention period of snapshot be extended beyond the default?

No, this cannot currently be extended on SaaS.


 

Supported Features

 

Can Synthetics be used for API testing/monitoring?

As of April 2016, API testing is in the long-term vision for Synthetic, but the feature is not on any roadmaps yet.  If the customer's use case involves monitoring the API from inside their network, then Service Availability is the preferred solution.  Monitoring from outside their network is not an option at this time.

 

Is virtual page naming (for single-page apps) supported in Synthetics?

Virtual pages are not yet supported in Synthetic (possible future feature), so virtual page naming is not supported.

 

Are JavaScript popups such as those created with window.alert or window.prompt supported?

Yes, JavaScript popups created with window.alert or window.prompt are fully supported.

 

Are multiple windows, as in multiple HTML documents loading either in different tabs or windows, supported?

Multiple windows or tabs with loaded HTML documents are only partially supported. You can create scripts to handle multiple windows, but the session results will combine the waterfall metrics and the resources from all of the windows into one page. Thus, you will not be able to view the individual results for each browser window.


 

Troubleshooting

 

How do I debug my script?

We recommend doing your initial debugging locally: that’s always the easiest place to debug. We capture the stdout and stderr streams from your script, so you can debug that way. And we show partial sessions for scripts that failed part-way through, so you can see what the browser did up until the script failed.

 

How do you prevent timeouts in scripts?

Timeouts in scripts can be prevented by explicitly waiting for specific element states (e.g., clickable). See also the paragraph Expected Conditions discussed in Explicit Waits.

 

If something breaks, how can I tell if it’s my site, my job, or your infrastructure?

If your script has an assertion failure, the session status is “Failed”, which indicates a problem with your site. If your script crashes, the session status is “Broken”, which indicates a problem with your script. If we can’t run your script, the session status is “Internal Error”. We hope you’ll never see that. For single-URL measurements, a 5xx is “Failed,” and a 4xx is “Broken”.

 

Why are visual metrics (Visually Complete, Speed Index) not always present?

There are currently two known issues regarding visual metrics:

  • In some cases, Chrome sessions may not display visual metrics because of a bug. This typically happens on pages with JS redirects, but may happen elsewhere as well. This is a Chrome-specific problem, and we are working on a solution.
  • A Windows issue will sometimes prevent these metrics to be computed for all browsers. When this happens, the agent needs to be rebooted. This is infrequent because we get alerts and react as fast as possible.
Version history
Revision #:
16 of 16
Last update:
Monday
Updated by:
 
Labels (1)


Found this article helpful? Click the Thumbs Up button.
Have an additional comment? Post it below.
0 Kudos
Comments
Hi, I've a question regarding the first article on this page 'On-Premise/SaaS'. First I'm missing the version specifications for the controller. Second the documentation for the 4.4.x and 4.5.x clearly gives instructions to use the Synthetic Agent with OnPremise installations. Can someone please help me out if we can use Synthetic Browser with AppDynamics having controller and eum-server onpremise ? Thanks in advance Sebastian

Hi Sebastian,

 

Thanks for bringing this up. Yes, The on-prem Synthetic Server was available starting in 4.5.4. You would need a Controller/EUM Server 4.5.4+ as well as the on-prem Synthetic Server. I've made a request to update the article, so the new information should be displayed shortly. Also, our documentation doesn't cover how to configure/use hybrid deployments, although we will help customers set it up if they need a hybrid deployment. 

Thanks you both @Sebastian.Wiemer and @Joe.Catera  - the article has been updated to reflect this information!

Hi, I notice with failed scripts there is an "Error Started' followed by 'Error confirmed after retest' which is great. When a session results in 'Broken' no event is created and the script is not retested - is that correct?

@Julian.Oxley, you're correct:

 

"I notice with failed scripts there is an "Error Started' followed by 'Error confirmed after retest' which is great. When a session results in 'Broken' no event is created and the script is not retested - is that correct?"

 

Thank you for pointing this out. @Joe.Catera  has updated the Synthetic Sessions documentation for the session status to note when the job is run or not rerun.

Hi,

 

I'm trying to handle the Allow Location Access pop-up in Firefox but I'm stuck, mainly because most of the solutions on the web instantiate a new driver with a profile similar to:

 

browser = webdriver.Firefox(firefox_profile=fp)

 

AppDynamics however automatically creates the driver object and ignores subsequent calls to Firefox:

 

WARNING: A Driver object is created automatically and is available as a local variable called `driver`. Ignoring call to `Firefox` on line 95 by returning `driver` reference.

 

Location-aware websites must be a common thing so I was hoping AppDynamics has a nifty solution to either reference the profile object created and update its preferences or change the profile after the driver is instantiated.

 

 

 

Screenshot 2019-11-05 at 11.43.05.png

Re. Allow Location Access pop-up in Firefox

 

In the end, the answer was simple - use Chrome! Along the way, I learnt it is possible to change preferences after the driver is instantiated based mostly on the work of https://stackoverflow.com/users/2887618/florent-b.

 

https://stackoverflow.com/questions/29776607/python-selenium-webdriver-changing-proxy-settings-on-th...

https://stackoverflow.com/questions/48213750/selenium-firefox-profile-update-download-directory-afte...

 

I got a script working in my local selenium installation:

 

from selenium import webdriver
driver = webdriver.Firefox()
driver.command_executor._commands["SET_CONTEXT"] = ("POST", "/session/$sessionId/moz/context")
driver.execute("SET_CONTEXT", {"context": "chrome"})
driver.execute_script("""
Services.prefs.setBoolPref('geo.enabled', true);
Services.prefs.setBoolPref('geo.provider.use_corelocation', true);
Services.prefs.setBoolPref('geo.prompt.testing', true);
Services.prefs.setBoolPref('geo.prompt.testing.allow', true);
Services.prefs.setStringPref('geo.wifi.uri', 'https://www.googleapis.com/geolocation/v1/geolocate?key=%GOOGLE_LOCATION_SERVICE_API_KEY%');
""")
driver.execute("SET_CONTEXT", {"context": "content"})

However, the script output in the agent was;

 

Base webdriver exception.
Exception: selenium.common.exceptions.WebDriverException
Message: POST /session/6f8cdce1-1952-49ee-a40b-aaee0b35a120/moz/context
Stack Trace
Line 36, in test_app_dynamics_job
driver.execute("SET_CONTEXT", {"context": "chrome"})
Line 312, in execute
self.error_handler.check_response(response)
Line 237, in check_response
raise exception_class(message, screen, stacktrace)

I also tried,

 

driver.set_context("chrome")

but that threw

 

AttributeError: 'WebDriver' object has no attribute 'set_context'

 

The bottom line on this; either Firefox in AppDynamics won't let you change the context, or I just didn't do it right. Either way, I got around this by simply using a Chrome browser.

 

Hope this helps!

 

Oh hey! Is it possible to get the name of the job in a script?

Hi Julian, 

 

I spoke to the engineering team working on the Synthetic Monitoring product today. They said there is no way to get the synthetic job name from the script, but you could use a log statement or a simple print statement to include the name of the job name in your script as a workaround. This page has some examples of how to include log messages in your script: https://docs.appdynamics.com/display/PRO45/Add+Logs+to+Troubleshoot#AddLogstoTroubleshoot-LoggingPac...

 

Thanks,

 

~Joe

 

Lol. In my setup I have three environments each of which have slightly different endpoints for the same script. I wanted the script to ‘discover’ which environment it was running in from an environmental value in the job name and use the correct endpoint.