automationrpawebautomationg1ant

'Element not visible' error when opening Chrome with G1ANT


Occasionally when G1ANT attempts to open a program (Google Chrome) it gives an error "element not visible", it does not happen often, in fact very rarely. When it does happen it's at the start of the script on the below line, the URL is a standard HTTP URL

selenium.open chrome url ♥Url

It seems as though it is not recognizing the program chrome at that moment. The error message is:

element not visible  (Session info: chrome=78.0.3904.97)
(Driver info: chromedriver=2.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),
platform=Windows NT 10.0.14393 x86_64)

Do you know what causes this and is there something I can do to stop it happening?


Solution

  • Here's how you can workaround this issue:

    ♥elementNotVisibleCount = 0
    label elementNotVisible
    ♥elementNotVisibleCount = ♥elementNotVisibleCount + 1
    if ⊂♥elementNotVisibleCount>=5⊃
    selenium.open chrome url ♥url
    end if
    selenium.open chrome url ♥url errorjump elementNotVisible if 
    ⊂♥elementNotVisibleCount<4⊃
    

    If an exception occurs, the robot will jump to the elementNotVisible label and try again maximum 4 times before it will try it the last time and if it fails it will finally throw the exception.

    Hope, it'll help you.