Error Messages During Test Execution
Below is a list of various error messages that may happen during test execution.
Authentication Error At The Time of Test Execution
This happens due to Username or Access Key passed by you is missing or invalid.
How To Resolve?
- Go to TestMu AI Automation Dashboard.
- Click on the key icon at the right top of the dashboard.
- Copy username and access key.
Max duration exceeded an error
The test was terminated because it exceeded the maximum duration allowed. (default is 1800 seconds).
Possible Cause:
This might be caused by several issues:
- Your test is too long. A single test case may be composed of multiple tests.
- Test stucks in the endless loop, where test keeps sending commands.
Possible Solution:
- Consider breaking up your test into smaller, atomic tests.
- You can use the maxDuration desired capability option to indicate how long you want to wait for your test to complete.
- In your test check for endless loops.
Test Cancellation – Status: Error
When a test is placed under a queue but gets cancelled before execution.
Possible Cause:
This might occur due to various reasons:
- The connection between the local machine of the user and TestMu AI cloud server is aborted.
- High latency may also lead your test script to test cancellation.
- User cancels the test manually after placing it in queue.
Exceeded Queue Limit Error
Your test runner started a new test on TestMu AI, but then closed the connection before we could make a new test session available.
Possible Cause:
This might occur due to several things:
- Client timeout with browser tests. Please make sure to set the connection timeout in your test runner/framework high enough, as old browsers take a while to start up. It would be best to wait for at least a couple minutes.
- You might be running too many tests at once. If you're exceeding the total number of concurrent test limit, we still queue the tests as per your plan. If this queueing takes too long, your test runner might disconnect before the test started.
Possible Solutions:
- Increase the connection timeout setting in your test runner/framework. For example, for WebdriverIO, you can set connectionRetryTimeout: 210000.
- Make sure you're not exceeding the total allowed concurrent test limit as per TestMu AI Automation plan you're subscribed to.
Lambda Error
There are times when you may encounter Lambda Error stating the below message.
Lambda Error: Uh Oh! Looks like our Grid failed to recognize your test input.
Possible Cause:
There could be numerous reasons behind this error messages. The most common ones are listed below:
- Infrastructure Unavailability: In case of too many incoming requests, sometimes our cloud server may fail to allocate a VM as per your request.
- Incorrect Data Type for Desired Capabilities: If you send a string input for an integer data type capability then you may encounter Lambda Error.
- Excessive web-traffic spikes may also lead to Lambda Error.
Element click intercepted - 400
The Element Click command could not be completed because the element receiving the events is obscuring the element that was requested clicked.
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <label _ngcontent-yrc-c26="" formcontrolname="reportingDealPermission" nz-checkbox="" class="ant-checkbox-wrapper ng-untouched ng-pristine ng-valid" ng-reflect-name="reportingDealPermission">...</label> is not clickable at point (161, 562). Other element would receive the click: <div _ngcontent-yrc-c26="" class="footer">...</div>
Possible Cause:
- It usually occurs when the target element that you want to click is overlaid by some other element in the web page.
Possible Solutions:
- There are multiple ways to solve the given issue - check StackOverFlow for more information
Element not interactable - 400
A command could not be completed because the element is not pointer- or keyboard interactable.
Possible Cause:
-
Element has not properly rendered
-
Element has rendered but it is not in the visible part of the screen
Possible Solutions:
For 1. -> Use implicit /explicit wait:
-
Implicit wait :
driver.manage().timeouts().implicitlyWait(50, TimeUnit.SECONDS); -
Explicit wait :
WebDriverWait wait=new WebDriverWait(driver, 20); element1 = wait.until(ExpectedConditions.elementToBeClickable(By.className("fa-stack-1x")));
For 2. -> Solution is just to scroll till the element. Based on the version of Selenium it can be handled in different ways. For more information, refer this link.
Insecure certificate - 400
Navigation caused the user agent to hit a certificate warning, which is usually the result of an expired or invalid TLS certificate.
Possible Cause:
- SSL works through a combination of programs and encryption/decryption routine that exist on the web server computer and web server browser.
- When a secure connection is not established between the server and client due to the certificate, following SSL certificate error will be manifested.
- Suppose you provide some https request in the browser and get a prompt such as "This connection is untrusted" or the "The site’s security certificate is not trusted" (which varies as per the browser being used). Then such an error is subject to SSL certificate error.
Possible Solutions:
We can essentially adjust our script such that the SSL exception is handled by itself, using Selenium Webdriver.
- For understanding and handling SSL errors - check this site for more information
Invalid Argument - 400
The arguments passed to a command are either invalid or malformed. Example:
It is for example not possible to set a window size to a negative value:
from selenium import webdriver from selenium.common import exceptions session = webdriver.Firefox()
try:
session.set_window_size(-10, 0)
except
exceptions.InvalidArgumentException as e: print(e.message)
Output:
InvalidArgumentException: Expected -10 to be >= 0
Possible Cause:
- The invalid argument error is a WebDriver error that occurs when the arguments passed to a command are either invalid or malformed.
- Invalid argument errors can be likened to TypeErrors in JavaScript, in that they can occur for a great many APIs when the input value is not of the expected type or malformed in some way.
Possible Solutions:
- Check the values in your input and ensure they are actually valid.
Invalid cookie domain - 400
An illegal attempt was made to set a cookie under a different domain than the current page.
org.openqa.selenium.ElementClickInterceptedException: element click intercepted: Element <label _ngcontent-yrc-c26="" formcontrolname="reportingDealPermission" nz-checkbox="" class="ant-checkbox-wrapper ng-untouched ng-pristine ng-valid" ng-reflect-name="reportingDealPermission">...</label> is not clickable at point (161, 562). Other element would receive the click: <div _ngcontent-yrc-c26="" class="footer">...</div>
Possible Cause:
- The invalid cookie domain error is a WebDriver error that occurs when an illegal attempt was made to set a cookie under a different domain than that of the current document. In WebDriver it is not permissible to set cookies for other domains than the domain of the current browsing context's document's domain. Example: If the current domain were to be 'example.com', it would not be possible to add a cookie for the domain 'example.org':
from selenium import webdriver
from selenium.common import exceptions
session = webdriver.Firefox()
session.get("https://example.com/")
try:
cookie = {"name": "foo",
"value": "bar",
"domain": "example.org"}
session.add_cookie(cookie)
except exceptions.InvalidCookieDomainException as e: print(e.message)
Output:
InvalidCookieDomainException: https://example.org/
Invalid element state - 400
A command could not be completed because the element is in an invalid state, e.g. attempting to clear an element that isn't both editable and resettable.
Possible Cause:
- When we try to perform some operation which is not applicable then it will throw InvalidElementStateException.
- Let’s assume if the textbox is disabled and if you try to perform type operation then it will throw an exception.
- If radio button,checkbox or any other web element is disabled and if you try to perform click event then it will throw an exception.
- If any element supports only click events and if you try to perform type events then again it will throw an exception
Possible Solutions:
- Ensure performing the required operation based on element state.
- If it is clickable element then perform click and if it supports type event then perform sendkeys.
- If the element is disabled then enable it first and then perform operations.
For more, refer this link (learn-automation.com) .
Invalid selector - 400
Argument was an invalid selector.
org.openqa.selenium.InvalidSelectorException: invalid selector
Possible Cause:
-
The invalid selector error is a WebDriver error that occurs when an element retrieval command is used with an unknown web element selector strategy.
-
The available selector strategies are CSS, link text, partial link text, tag name, and XPath. Any other selector strategy is rejected with this error.
Possible Solutions:
- Do check the punctuation's such as @, ', and [].
- Make sure that there is only one field name with that path; else, use the contains() method
The case where session not generated - invalid session id 404, session not created 500
Invalid session id - 404
Occurs if the given session id is not in the list of active sessions, meaning the session either does not exist or that it's not active.
ERROR webdriver: Request failed with status 404 due to invalid session id: invalid session
Possible Cause:
- As of 04/2021, sync mode will not be supported anymore starting from Node.js v16 due to changes in Chromium.
- It is therefore advisable to use async to solve this error
- The WebdriverIO site has an official guideline for the same - "How to enable/disable sync mode". Please take a look on this: WebdriverIO
Session not created - 500
A new session could not be created.
org.openqa.selenium.SessionNotCreatedException: Message: Could not start a new session. Response code 500. Message: session not created
Possible Cause:
- Incompatibility between version of the binaries being used
Possible Solutions:
- Can be primarily solved by ensuring Chrome version being used and the JDK, driver versions are compatible. Refer this link - stackoverflow
JavaScript error - 500
The Javascript error is a WebDriver error that occurs when a script the supplied by the user fails to execute.
Example:
from selenium import webdriver
from selenium.common import exceptions
session = webdriver.Firefox()
try:
session.execute_script("return foo")
except exceptions.JavascriptException as e:
print(e.message)
Output:
JavascriptException: ReferenceError: foo is not defined
Possible Cause:
- The underlying cause of the execution error is often supplied in the error message, along with a stacktrace provided by the JavaScript engine in the browser.
Possible Solutions:
- Check for invalid declarations and definitions in your code
Invalid selector - 400
Argument was an invalid selector.
org.openqa.selenium.InvalidSelectorException: invalid selector
Possible Cause:
-
The invalid selector error is a WebDriver error that occurs when an element retrieval command is used with an unknown web element selector strategy.
-
The available selector strategies are CSS, link text, partial link text, tag name, and XPath. Any other selector strategy is rejected with this error.
Possible Solutions:
- Do check the punctuation's such as @, ', and [].
- Make sure that there is only one field name with that path; else, use the contains() method
Move target out of bounds - 500
The target for mouse interaction is not in the browser’s viewport and cannot be brought into that viewport.
Example:
MoveTargetOutOfBoundsException: Element cannot be scrolled into view
Possible Cause:
- Selenium enables replication for exact human behavior, so if code failure indicates element is not visible, then it is actually a case of element not being visible.
Possible Solutions:
- For a concise explanation regarding this error - refer here.
No such alert - 404
An attempt was made to operate on a modal dialog when one was not open.
Exception in thread "main" org.openqa.selenium.UnhandledAlertException: Unexpected modal dialog (text: You need to use IE 6.0 for viewing this application. Else some features may not work): You need to use IE 6.0 for viewing this application. Else some features may not work
Possible Cause/explanation:
Refer these links for one of the possible explanations:
- no-alert-is-present-no-modal-dialog-found-webdriver-unable-to-catch-js-error
- selenium-webdriver-unexpected-modal-dialog-alert
No such cookie - 404
No cookie matching the given path name was found amongst the associated cookies of the current browsing context's active document.
Example:
org.openqa.selenium.UnableToSetCookieException: Unable to set cookie (WARNING: The server did not provide any stacktrace information)
Possible Cause:
- Creating a cookie before navigation to the site
Possible Solutions:
- For a concise explanation regarding this error - refer here.
No such element - 404
An element could not be located on the page using the given search parameters.
Example:
exception selenium.common.exceptions.NoSuchElementException(msg=None, screen=None, stacktrace=None)
Possible Cause:
Majorly in two cases
-
When using
webdriver.find_element_by_*("expression") //example : my_element = driver.find_element_by_xpath("xpath_expression") -
When using
element.find_element_by_*("expression")//example : my_element = element.find_element_by_*("expression")
There are different possibilities for this error to occur. Check the link below for more information.
Possible Solutions:
- A detailed explanation regarding this error - refer here.