-1

I have to check the breadcrumb element (Dashboard) on a webpage. When opened manually, the Dashboard element appears with icons and is operational, but when run through Java Selenium Eclipse Script, the Dashboard element is not there in HTML.

Here is the HTML in normal Chrome browser

<a role="link" class="imc-subnavigation-header__breadcrumbs__item__link" data-ng-click="navigateOnBreadcrumb(breadcrumb)" data-ng-keydown="$event.keyCode === 13 ? navigateOnBreadcrumb(breadcrumb) : false" aria-label="breadcrumbTooltip" tabindex="0">
          <div class="imc-subnavigation-header__breadcrumbs__item__link__icon"></div>
          <!-- ngIf: breadcrumb.page.info.icon -->
          <div aria-hidden="true" class="imc-subnavigation-header__breadcrumbs__item__link__text ng-binding">Dashboard</div>
        </a>

But when I open the same page through my Automation code using Webdriver, the Dashboard breadcrumb is completely absent.

HTML in Automation window:

<imc-subnavigation-breadcrumbs class="ng-isolate-scope"><!-- ngIf: hasBreadcrumbsToDisplay --><div class="imc-subnavigation-header__breadcrumbs hide-for-print ng-scope" data-ng-if="hasBreadcrumbsToDisplay">
    <!-- ngRepeat: breadcrumb in breadcrumbs --><!-- ngIf: !$last || onlyRoot --><!-- end ngRepeat: breadcrumb in breadcrumbs -->
</div><!-- end ngIf: hasBreadcrumbsToDisplay -->
</imc-subnavigation-breadcrumbs>

I have applied all kinds of waits, thread.sleeps and the page loads completely. I tried on a faster network, yet the behavior is the same: the element does not appear through automation while manually it appears all the time.

What kind of issue is this? How do I go with automating this Dashboard (breadcrumb) element?

3
  • <a role="link" class="imc-subnavigation-header__breadcrumbs__item__link" data-ng-click="navigateOnBreadcrumb(breadcrumb)" data-ng-keydown="$event.keyCode === 13 ? navigateOnBreadcrumb(breadcrumb) : false" aria-label="breadcrumbTooltip" tabindex="0"> <div class="imc-subnavigation-header__breadcrumbs__item__link__icon"></div> <!-- ngIf: breadcrumb.page.info.icon --> <div aria-hidden="true" class="imc-subnavigation-header__breadcrumbs__item__link__text ng-binding">Dashboard</div> </a>
    – Thara B C
    Jan 15 at 0:08
  • HTML in Automation window <imc-subnavigation-breadcrumbs class="ng-isolate-scope"><!-- ngIf: hasBreadcrumbsToDisplay --><div class="imc-subnavigation-header__breadcrumbs hide-for-print ng-scope" data-ng-if="hasBreadcrumbsToDisplay"> <!-- ngRepeat: breadcrumb in breadcrumbs --><!-- ngIf: !$last || onlyRoot --><!-- end ngRepeat: breadcrumb in breadcrumbs --> </div><!-- end ngIf: hasBreadcrumbsToDisplay --> </imc-subnavigation-breadcrumbs>
    – Thara B C
    Jan 15 at 0:09
  • Welcome to the community! You can delete the code you added in the comments. When posting a question or answer, please use the code formatting tools included in the rich text editor. For code, you want to use the { } button!
    – Lee Jensen
    Jan 16 at 18:53

1 Answer 1

0

If the Dashboard breadcrumb is loaded dynamically using JavaScript, it's possible that the Selenium WebDriver isn't waiting long enough for the JavaScript to execute and render the element. You mentioned you have tried different waits, but consider using Explicit Waits in Selenium to wait specifically for the element to be present....Also Do you have any error logs?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.