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.
If you use Selenium, then try this