• prabakar m
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
Create an automated test script for salesforce application using selenium webdriver with java. I have some clarification in my XPath. Below is the HTML code for the salesforce application [Lightning mode]

<div one-appnavbarmenubutton_appnavbarmenubutton="" class="menuItemsWrapper" style="" xpath="1"> <slot one-appnavbarmenubutton_appnavbarmenubutton=""> <one-app-nav-bar-menu-item one-appnavbaritemdropdown_appnavbaritemdropdown="" class="slds-dropdown__item" one-appnavbarmenuitem_appnavbarmenuitem-host=""> <span one-appnavbarmenuitem_appnavbarmenuitem="" class="slds-truncate"> <span one-appnavbarmenuitem_appnavbarmenuitem="">Tech Path </span> </span> </one-app-nav-bar-menu-item> <one-app-nav-bar-menu-item one-appnavbaritemdropdown_appnavbaritemdropdown="" class="slds-dropdown__item" one-appnavbarmenuitem_appnavbarmenuitem-host=""> <span one-appnavbarmenuitem_appnavbarmenuitem="" class="slds-truncate"> <span one-appnavbarmenuitem_appnavbarmenuitem="">Keyword </span> </span> </one-app-nav-bar-menu-item> <one-app-nav-bar-menu-item one-appnavbaritemdropdown_appnavbaritemdropdown="" class="slds-dropdown__item" one-appnavbarmenuitem_appnavbarmenuitem-host=""> <span one-appnavbarmenuitem_appnavbarmenuitem="" class="slds-truncate"> <span one-appnavbarmenuitem_appnavbarmenuitem="">Invention Disclosures by Hierarchy </span> </span> </one-app-nav-bar-menu-item> </slot> </div>

From the above, I want to get the total no of tag <one-app-nav-bar-menu-item>
below is my test script
WebElement menuCount = driver.findElement(By.xpath("//div[@class='menuItemsWrapper']//slot")) List<WebElement>menuItemCount = menuCount.findElements(By.tagName("one-app-nav-bar-menu-item"))
When I executed i am getting the menuITemCount =0
Let me know is there any problem in my script
Environment: chrome driver
 
From salesforce lightning application
I want to get the value of the Href attribute from the <a> tag

HTML code
<one-app-nav-bar-item-root one-appnavbar_appnavbar="" data-id="home" data-assistive-id="operationId" aria-hidden="false" draggable="true" class="navItem slds-context-bar__item slds-shrink-none slds-is-active" role="listitem" xpath="1"> <a href="/lightning/page/home" title="Home" tabindex="0" draggable="false" aria-describedby="operationId-14" class="slds-context-bar__label-action dndItem" style=""> <span class="slds-truncate">Home</span> </a></one-app-nav-bar-item-root>

my selenium code to get the href attribute value
WebElement getHref = driver.findElement(By.xpath("//one-app-nav-bar-item-root[1]//a[1]"))

Output for the above code: null

when I execute the same in another driver like FF I'm getting my expected Href value (/lightning/page/home).

Can anyone faced this issue, let me know how can I solve this? is a browser issue or else?