2

I followed a couple of solutions to this problem on this platform, especially Trouble selecting a hidden menu item using SeleniumBasic for vba

I was able to hover through the menu of the website I'm trying to automate, but I'm unable to click on the table row (Claims Submission) which is the second option when the table/form is visible.

My initial goal was to hover the visible menu of the page to show a drop down and I achieved that with a loop.

Now when the (claims) Menu is visible I need to click on the second option (Claims Submission) of that table. As directed from Trouble selecting a hidden menu item using SeleniumBasic for vba I attempted to use an xpath to reference the element.

It returned

Run-time error '7':
NoSuchElementError
Element not found for XPath=//a[.//span[contains(.,'Claims Submission')]]

Private WB As Selenium.WebDriver
Sub Test()

Set WB = New Selenium.ChromeDriver

WB.Start

WB.Get "https://health.axamansard.com/axamansardProviderlogin/Index.aspx"

Dim Menu As WebElement
Dim Menus As WebElements

Dim MenuSubmission As WebElement

WB.FindElementByName("txtUname").SendKeys "Almadina"

WB.FindElementByName("txtPass").SendKeys "Nhisdesk@1234"

WB.FindElementByName("btnSubmit").Click

Set Menus = WB.FindElementsByClass("a")

For Each Menu In Menus
    If Menu.Text = "Claims" Then
        WB.Mouse.MoveTo Menu
    
        Set MenuSubmission = WB.FindElementByXPath("//a[.//span[contains(.,'Claims Submission')]]")
        MenuSubmission.Click
        
    End If
Next

End sub

WebScript

<table class="menu" id="Claims" width="150px" bgcolor="white" style="visibility: hidden;">
                <tbody><tr height="19px">
                    <td class="menu"><a class="a" 
 href="../Forms/ClaimsBatch.aspx">Claims Batch</a></td>
                </tr>
                <tr height="19px">
                    <td class="menu"><a class="a" 
 href="../Forms/ClaimSubmission.aspx">Claims Submission</a></td>
                </tr>
                <tr height="19px">
                    <td class="menu"><a class="a" 
 href="../Forms/ClaimSubmissionList.aspx">Claims Submission List</a></td>
                </tr>
                <tr height="19px">
                    <td class="menu"><a class="a" 
 href="../Forms/ClaimsUpload.aspx">Claims Upload</a></td>
                </tr>
                <tr height="19px">
                    <td class="menu"><a class="a" 
 href="../Forms/Calimreviewlist.aspx">Claims Status</a></td>
                </tr>
                <tr height="19px">
                    <td class="menu"><a class="a" 
 href="../Forms/ProviderClaimsBatchDetails.aspx">Provider Claims Batch Details/Claim Credit Note Details</a></td>
                </tr>
            </tbody></table>
Community
  • 1
  • 1
Israel
  • 21
  • 5

1 Answers1

0

The xpath to the link Claims Submission seems a bit off. You can use either of the following Locator Strategies:

  • FindElementByXPath:

    WB.FindElementByXPath("//table[@id='Claims']//td/a[.='Claims Submission']").Click
    
  • FindElementByXPath relative to Claims:

    WB.FindElementByXPath("//a[.='Claims']//following::table[1]//td/a[.='Claims Submission']").Click
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352