Click on the web page tab (if visible)
P粉704066087
P粉704066087 2023-09-13 23:15:38
0
1
519

I have been trying to use code to click a tab in a web page

Set P = D.FindElementByCss("a[href='#pro-content-pro']")
    P.Click

The above code works fine if the tab is visible in the web page, but does not work if the tab is not visible. The following is the HTML code

When visible

<li data-bind="attr:{ 'id': id }, click: onClick, visible: isVisible, css: {'active': isActive, 'disabled-control': !isEnabled() }" class="active">
                <a data-toggle="tab" role="tab" data-bind="attr:{ href: '#' + sectionId, id: linkId }, css: { 'disabled': !isEnabled() }" href="#pro-content-pro">
                    <span data-bind="text: title">Proforma</span>
                </a>
            </li>

When invisible

<li data-bind="attr:{ 'id': id }, click: onClick, visible: isVisible, css: {'active': isActive, 'disabled-control': !isEnabled() }" class="disabled-control">
                <a data-toggle="tab" role="tab" data-bind="attr:{ href: '#' + sectionId, id: linkId }, css: { 'disabled': !isEnabled() }" href="#pro-content-pro" class="disabled">
                    <span data-bind="text: title">Proforma</span>
                </a>
            </li>

If the tab is not visible please suggest me the correct code and skip it otherwise click on the tab if the tab is visible.

Thank you so much.

P粉704066087
P粉704066087

reply all(1)
P粉464113078

If you use Selenium, then try this

Set P = D.FindElementByCss("a[href='#pro-content-pro']")
    If P.Attribute("class")="disabled" Then
    Else    
        P.Click
    End If
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template