1

Basic Info: Selenium WebDriver, Eclipse, Java, Firefox Driver

I'm receiving this error:

`

Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: 
Build info: version: 'unknown', revision: '5234b32', time: '2017-03-10 09:00:17 -0800'
System info: host: 'MILTON-MENDIETA', ip: '10.77.60.197', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\Milton\AppData\Local\Temp\rust_mozprofile.POZZHDGnD1QQ, rotatable=false, timeouts={implicit=0, page load=300000, script=30000}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=52.0.2, platformVersion=10.0, moz:processID=14868, browserName=firefox, platformName=windows_nt}]
Session ID: 3172ee71-f22c-4699-a723-3c27a87c6ce5
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:133)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:99)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:43)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:274)
    at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)

`

This happens as soon as the I land on the page, after calling get().

Here is the code I have to wait for the element to be visible:

WebDriverWait wait = new WebDriverWait(driver, 20);

 for(int counter = 25; counter < 50; counter++){  
                  // Navigate to Site

                  driver.get("https://sandbox.webcomserver.com/wpm/adminHome.do?&tenantName=walkme_test");


                  //Wait for SmartTip to be visible

                 // wait.until(ExpectedConditions.visibilityOfElementLocated((By.cssSelector("a#helpLink"))));

                  //Wait for Widget to be visible (Could be a method? MyClass.openWidget() ?

                  wait.until(ExpectedConditions.visibilityOfElementLocated((By.id("walkme-player"))));
                  driver.findElement(By.id("walkme-player")).click();

                 //Start Add Status to WorkFlow WT
                  wait.until(ExpectedConditions.visibilityOfElementLocated((By.cssSelector("div.walkme-walkthru-219559"))));
                  driver.findElement(By.cssSelector("div.walkme-walkthru-219559")).click();

                  //Wait for Step (Hover over Workflows) to be visible
                  wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("walkme-balloon-2412584")));

It gives me the error as soon as the page loads. Should it not be waiting 20 seconds before throwing the error?

I've tried using different selectors such as className, cssSelectors, and id.

HTML Snippet:

<div id="walkme-player" class="walkme-player walkme-colorado walkme-theme-white-green walkme-direction-ltr walkme-notie walkme-position-major-bottom walkme-position-minor-right  walkme-dynamic-size walkme-to-destroy walkme-override walkme-css-reset walkme-language-default" style="display: block; bottom: 0px;" data-inanimation="0">
    <div class="walkme-in-wrapper walkme-override walkme-css-reset" style="width: 154px;">
        <div class="walkme-question-mark walkme-override walkme-css-reset"></div>
        <div class="walkme-title walkme-override walkme-css-reset">Need help?</div>
    </div>
</div>

I'm pretty sure it's just evaluating it as not visible before the element loads because it occasionally works. I've even tried adding an implicit wait, thread.sleep(), and it still doesn't wait. Not sure what else to do.

  • Is your element is in `iFrame` ? – NarendraR Apr 19 '17 at 18:09
  • No it's not in an iFrame. It's in html/body/div – Milton Mendieta Apr 19 '17 at 18:12
  • can you share the site URl – NarendraR Apr 19 '17 at 18:13
  • Unfortunately, as much as I want to I can't because it's a customer website. I'd have to include credentials for you to see it. Here is a picture of more HTML, and the element I want it to wait to be visible. https://www.screencast.com/t/OcaebmaeBbBk – Milton Mendieta Apr 19 '17 at 18:18
  • I'm seeing some iframe tags in your html. probably your element is under iframe check it again. You need to switch into iframe to locate the element – NarendraR Apr 19 '17 at 18:25
  • I know you said you tried to locate by id, but id is the only attribute that is exactly equal. I see no other "walkme-player" values for class names in the HTML code you provided. The other classes start with "walkme-" but that's all I see. Also have you declared an implicit wait for the driver, to give the page time to load? – Bill Hileman Apr 19 '17 at 18:48
  • @MiltonMendieta Which one of the divs you are trying to get? Top level one with the id 'wlakme-player'? By.className("walkme-player") will not work because the class you mention is one of the classes and not all of them. If it is the top div you are better off with id. – Grasshopper Apr 19 '17 at 19:00
  • @NarendraRajput The iFrame Tag ends before the div tag. Bill hmm, that's interesting, could've sworn the class was that yesterday. I did change it to byId now, i'm still getting the same issue. For the Implicit wait, I simple wrote "driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); " Before it waits to search for the visibility. – Milton Mendieta Apr 19 '17 at 19:10
  • @BillHileman See Above. – Milton Mendieta Apr 19 '17 at 19:11
  • Please post some of the code you are using prior to the line you have posted already. Don't mix implicit and explicit waits because it can cause strange timing issues. Make sure that implicit wait is not used anywhere and change your `WebDriverWait` to wait for the element by ID, `walkme-player`. That's the most likely to be unique on the page. The element is definitely not under an IFRAME per the screenshot. It is possible that there is another element that matches the locator you have provided. Open the dev toolbar in Chrome and try `$$("#walkme-player").length`. Does it return `1`? – JeffC Apr 19 '17 at 20:10
  • @JeffC, Here's some more code. https://www.screencast.com/t/qN57np7H. I've updated it to ID. It does return 1, when I enter that in. Before this line, it's just logging into the page. I've removed all implicit waits, there weren't any when I wrote this issue. – Milton Mendieta Apr 19 '17 at 20:25
  • Please post the code in the question itself because in the future if this screenshot disappears, the question won't have the code. When you run this code, what happens? What error are you getting? Please post the full error message. – JeffC Apr 19 '17 at 20:55
  • @JeffC I've included the full error message, in the post above. `Exception in thread "main" org.openqa.selenium.ElementNotVisibleException:` is what stands out to me. – Milton Mendieta Apr 19 '17 at 21:03
  • @MiltonMendieta If you put a `sleep` of 5 or 10 seconds before your wait until visible check, does that work? 2 possible scenarios, your element is visible, and then something on your page makes it invisible after your check. Or, `visibilityOfElementLocated` is checking for `visibility` differently than the `FirefoxDriver` is. – mrfreester Apr 19 '17 at 22:01
  • Really though, I think you just need to click something inside of that `div`, and not the `div`, since maybe the `div#walkme-player` might not actually be the visible element. – mrfreester Apr 19 '17 at 22:05
  • @mrfreester, It worked for a few times, and then I received the same error again. – Milton Mendieta Apr 25 '17 at 16:17
  • @MiltonMendieta hey. Are you trying to test walkme, or you're testing an app that has walkme AND you just want to close it before test? If second, I have a solution. Let me know – Sergey Pleshakov Nov 02 '18 at 23:56

0 Answers0