TestProject Forum
Powered by leading experts in the test automation community

Not Clicking "Element not visible

I am very new to automation and recording. But I have tried every possible way to get it to select the 4th or 5th star. xpath, css etc nothing seems to work. Any suggestions for a new comer to test automation.

Timeout occurred after 15000ms, trying to perform a click: Element state is invalid (obscured by another element or invisible): ElementNotVisibleException: Element is not visible

Shared with CloudApp

image

If I need to provide more information please let me know.

Thanks in Advance

Hi @marcel.bauer
Looks like you did everything correctly.
The reason why it fails is that element you are trying to click being covered with some another element that intercepts the click action on itself. You can understand this by the part of the error message where it tells that the element was obscured.
This can be easily resolved by changing regular click action to Click using JavaScript

This click will be made with JavaScript, which means that it will interact directly with the element in html page.
Regular click using Selenium and tries to apply click on top of the element which sometimes may cause this failures

Thank you for the quick reply, I am now getting a different error which is some progress :slight_smile:

java.util.concurrent.ExecutionException: org.openqa.selenium.JavascriptException: javascript error: Cannot read property ‘click’ of null
(Session info: chrome=84.0.4147.89)
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:17:03’
System info: host: ‘localhost’, ip: ‘127.0.0.1’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.15.6’, java.version: ‘13.0.1’
Driver info: io.testproject.java.sdk.v2.drivers.WebDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 84.0.4147.89, chrome: {chromedriverVersion=84.0.4…, goog:chromeOptions: {debuggerAddress=localhost:…, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, proxy: {proxyType=UNSPECIFIED, aut…, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit=0.0, pageLoad=300…, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true, webdriver.remote.sessionid: 084ff40f6029f45b0bdc115821f…}
Session ID: 084ff40f6029f45b0bdc115821f7851a
Caused by org.openqa.selenium.JavascriptException: javascript error: Cannot read property ‘click’ of null
(Session info: chrome=84.0.4147.89)
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:17:03’
System info: host: ‘localhost’, ip: ‘127.0.0.1’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.15.6’, java.version: ‘13.0.1’
Driver info: io.testproject.java.sdk.v2.drivers.WebDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 84.0.4147.89, chrome: {chromedriverVersion=84.0.4…, goog:chromeOptions: {debuggerAddress=localhost:…, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: MAC, platformName: MAC, proxy: {proxyType=UNSPECIFIED, aut…, setWindowRect: true, strictFileInteractability: false, timeouts: {implicit=0.0, pageLoad=300…, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true, webdriver.remote.sessionid: 084ff40f6029f45b0bdc115821f…}
Session ID: 084ff40f6029f45b0bdc115821f7851a at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)

@marcel.bauer and this error is telling that element was not found.

This comes from that part of the error message:

Cannot read property ‘click’ of null

It may often happen when the locator of the element is dynamic (have some numbers in ID that changes each time your reload the page)
So if you saved the element with ID = “something-123”
And reload the page, it will become ID = “something-824”

I would be glad glad to help you resolving this if it’s possible for you to provide a link to the web page where you trying to achieve this.
If this is not possible, i will suggest you trying to change the locator of this element to more relative

//input[@type=‘hidden’ and contains(@id,‘18820’)]

or

//input[contains(@name,‘answers’) and value=‘73712’]

I wish I could but it is our private production sight.

Quick question is this (newb here) should those suggestions on locator be xpath or CSS?

@marcel.bauer
Those that I provided is XPath

@Vladyslav still nothing working. Are you able to access this link?
https://www.hyundaicustomerfeedback.com/your_input/P9BXfRH2bpBGkiqZoedU

this is the form I am working on

Hello @marcel.bauer.

I’ve navigated to the link you provided and have used to following XPATH to interact with the star rating on the page by performing a regular click element action:

//span[5]/i[@class = ‘far fa-star survey-star-rating’]​

You can replace the 5 with any other number from 1 through 4 to select any of the other stars.

So weird I think I got it all set the same way but when I run the test it still doesn’t seem to click it.

5 Star

Found by XPATH://span[5]/i[@class = ‘far fa-star survey-star-rating’]

Timeout occurred after 15000ms, trying to perform a click: Element was not found

If the element is not found, that means the locator is invalid.
Perhaps your production environment is structured differently than the link provided here?
I would check the class of the element on your version of the page.

Seems to be the same. Really at a loss right now. I sincerely appreciate all the help though, hopefully I can get this working as this will be a huge blocker for majority of my tests that I have written out. :frowning:

@marcel.bauer Please contact our team on the support chat, we can better troubleshoot from there.
You can click this icon on the site and re-explain the situation or provide a link to this forum thread:
image

Thank you I will contact them now

I was able to resolve this by using the Mouse Move option…moving over the stars, then next step to click on the stars.