Selenium step for "Click Element" fails when the element is out of screen in the browser.

book

Article ID: 7549

calendar_today

Updated On:

Products

CA Application Test Service Virtualization

Issue/Introduction

When I tried to execute Selenium integration test cases, I sometimes encountered the error message in the Selenium step for "Click Element" action like below:
============================================================================
| Error executing Selenium Step :
[{"negated":false,"type":"clickElement","locator":{"type":"xpath","value":"<Element Xpath>"}}]
============================================================================
| Step:        ClickElement
----------------------------------------------------------------------------
| Message:     {"negated":false,"type":"clickElement","locator":{"type":"xpath","value":"<Element Xpath>"}} failed.
----------------------------------------------------------------------------
| Trapped Exception: {"negated":false,"type":"clickElement","locator":{"type":"xpath","value":"<Element Xpath>"}} failed.
| Trapped Message:   java.lang.RuntimeException: {"negated":false,"type":"clickElement","locator":{"type":"xpath","value":"<Element Xpath>"}} failed.
----------------------------------------------------------------------------
STACK TRACE
java.lang.RuntimeException: {"negated":false,"type":"clickElement","locator":{"type":"xpath","value":"<Element Xpath>"}} failed.
    at com.sebuilder.interpreter.TestRun.executeStep(TestRun.java:81)
    at com.itko.lisa.glass.SeleniumScriptExecutor.executeStep(SeleniumScriptExecutor.java:373)
    at com.itko.lisa.glass.SeleniumScriptExecutor.executeStep(SeleniumScriptExecutor.java:305)
    at com.itko.lisa.glass.SeleniumStep.execute(SeleniumStep.java:313)
    at com.itko.lisa.test.TestNode.executeNode(TestNode.java:981)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1295)
    at com.itko.lisa.test.TestCase.execute(TestCase.java:1210)
    at com.itko.lisa.test.TestCase.executeNextNode(TestCase.java:1195)
    at com.itko.lisa.editor.WalkThruPanel.prepAndExecNode(WalkThruPanel.java:1057)
    at com.itko.lisa.editor.WalkThruPanel.access$900(WalkThruPanel.java:70)
    at com.itko.lisa.editor.WalkThruPanel$10.doCallback(WalkThruPanel.java:964)
    at com.itko.util.swing.panels.ProcessingDialog$2.run(ProcessingDialog.java:194)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with
Command duration or timeout: 568 milliseconds
...
============================================================================

Cause

This is a known problem in Selenium Integration test cases when the element to be clicked exists but that element is not visible in the browser.

Environment

Release Service Virtualization  9.1, 9.5, 9.5.1, 10.0, 10.1

Component: Workstation, Simulator

Resolution

To maximize the browser before clicking the element sometimes can solve the problem but sometimes cannot solve the problem. That is depended on the size and the layout of the page which includes the element to be clicked.

Please contact CA Support and open a case to handle this problem to get the solution. CA support will deliver the patch for this problem. The feature of the patch focuses to the element before clicking it.