When creating a Selenium script for Experience monitoring, there are a number of issues that can arise that are time-consuming to understand and to resolve. We have identified a number of these and have provided suggested solutions for each.

If none of the issues listed below address the problem you are having, please contact AppNeta Support.

“AndWait” timeout

Description: When using a command with the “AndWait” suffix (for example, “clickAndWait”), it can time out after 30 seconds rather than continue immediately as expected.

Rationale: In cases where the command is used with an element that does not cause a new page to load, this issue can occur. The “AndWait” suffix should only be used with elements that cause a new page to load.

Solution: Attempt to use the command without the “AndWait” suffix.

“waitFor” timeout

Description: When using a command with the “waitFor” prefix (for example, “waitForElementPresent” or “waitForVisible”), it can time out after 30 seconds rather than continue immediately as expected.

Rationale: This issue typically occurs when the locator used with the command does not correctly reference the element you are trying to use.

Solution: Revise the locator to properly identify the element. Prior to using the locator in your script, you should test it.

“Element is not clickable at point” error

Description: The “Element is not clickable at point (x, y)” error message indicates that the “click” command used was not able to execute.

Rationale: Because Selenium acts as a user would, if the element it is trying to operate on is not ready or is not visible when the command is executed, it will not work. This can occur in a variety of ways, including:

  • Something on the page is not yet active or loaded (indicated by a “spinner”).
  • Something (for example, a pop-up or overlay) is blocking the element from view.

Solution: If the issue was due to a resource not being available when the command executed, use a command such as “waitForElementPresent” or “waitForVisible” to wait until the element is available before trying to access it. If the issue was due to a pop-up or overlay being in the way, you can try using “clickAt(<locator>, 0, 0)” instead of “click”. Also, see Selenium Pop-up Handling for additional options.

Script timeouts

Description: There are pages that take so long to load that the script times out waiting for them.

Rationale: This can occur when a page loads a resource that is slow to load.

Solution: One option is to increase the interval between script executions in APM (configure the Web App Group). This automatically increases the timeout value. Another option is to “blacklist the resource” that is slow to load.

“No such element” exception

Description: The script fails with a “No such element” error.

Rationale: This error typically occurs when a locator you are using does not identify the correct web element or the element is “dynamic”.

Solution: The locator in error needs to be revised. See Identifying Web Elements for help creating locators.

Interacting with dynamic elements

Description: Some elements contain dynamic attributes - those that change each time the page is loaded. Typically, you can identify these because the attribute value contains a long string of numbers.

Rationale: Using the dynamic attribute value in your script will cause the script to fail the next time the page is loaded as its value will have changed.

Solution: Use a non-dynamic attribute or, if possible, match the part of the attribute that is static.

Pop-up or element appears periodically

Description: The script fails because the element or pop-up you want to use only appears periodically. You want the script to interact with the element when it is visible and simply continue if it is not.

Rationale: An example is a pop-up that appears at the end of each month.

Solution: Use the “clickIfVisible” command to click the element only if it is visible and continue execution if it is not.

Description: You created a locator that matches link text and it is failing even though the text you are using exactly matches that you see in the page source.

Rationale: The text that Selenium is trying to match is that that is rendered rather than that in the page source. So, for example, if there is CSS that changes the case of the text in the source to all caps and your script is trying to match the original version of the text, your locator will fail.

Solution: Make sure the case of the text in your locator matches the visual representation of the link text on the page.

Description: When a link is clicked, it opens the page in a new tab. The new tab is not active.

Rationale: When this happens and you need to access an element on the new page you need to change script execution to the new tab.

Solution: Use the selectActiveWindow() command to switch execution to the new tab.

Purple diamond on web path performance history

Description: You see a purple diamond on the web path performance history page in APM that indicates “Delayed transaction” event.

Rationale: This indicates that the monitoring point is overloaded and transactions are failing as a result.

Solution: Either reduce the number of web paths running on the monitoring point or increase the script execution interval for the web app group(s).

Only data for milestone 1

Description: You have a script with multiple milestones but you only see data for the first milestone in APM.

Rationale: This happens with single-page web apps. In these cases, because we collect data when a page loads and there are no additional page loads, no additional data is collected.

Solution: None. AppNeta is working on a resolution to this issue.

Difficulties logging out of a website

Description: You are trying to write steps in your script to log out of a website but are having difficulty.

Rationale: Creating a script to logout of some sites is not straightforward.

Solution: To simplify the logout procedure in the script, use the “open(<target>)” command with the logout URL as the <target>.

The page loads in a mobile or unexpected view

Description: Pages can be rendered differently depending on the type of device (user agent) running the browser.

Rationale: A script can fail if it expects an element to be present but, in a given rendering, it is not.

Solution: Use the setUserAgent() command to set the user agent explicitly so that the page renders as expected.

The element is only visible if you hover over its parent

Description: You want to access an element but it is only visible when you hover over its parent.

Solution: Use the mouseOver() command to simulate mousing over the parent element.