I have a button that shows collapsible moves when clicked:
https://i.sstatic.net/cTQvg.gif
Here is the information it contains:
<strong data-bind="css: {'admin__collapsible-title': collapsible,
title: !collapsible,
'_changed': changed,
'_loading': loading,
'_error': error}" class="admin__collapsible-title">
<span data-bind="i18n: label">Sales Matrix</span>
<!-- ko if: collapsible --><span class="admin__page-nav-item-messages">
<span class="admin__page-nav-item-message _changed">
<span class="admin__page-nav-item-message-icon"></span>
<span class="admin__page-nav-item-message-tooltip" data-bind="i18n: 'Changes have been made to this section that have not been saved.'">Changes have been made to this section that have not been saved.</span>
</span>
<span class="admin__page-nav-item-message _error">
<span class="admin__page-nav-item-message-icon"></span>
<span class="admin__page-nav-item-message-tooltip" data-bind="i18n: 'This tab contains invalid data. Please resolve this before saving.'">This tab contains invalid data. Please resolve this before saving.</span>
</span>
<span class="admin__page-nav-item-message-loader">
<span class="spinner">
<!-- ko repeat: 8 --><span data-repeat-index="0"></span><span data-repeat-index="1"></span><span data-repeat-index="2"></span><span data-repeat-index="3"></span><span data-repeat-index="4"></span><span data-repeat-index="5"></span><span data-repeat-index="6"></span><span data-repeat-index="7"></span><!-- /ko -->
</span>
</span>
</span><!-- /ko -->
</strong>
Despite various attempts, I am unable to click on the button successfully.
My attempts include:
a) driver.findElement(By.xpath("//span[contains(text(),'Sales Matrix')]")).click();.
b) driver.findElement(By.xpath("//span[normalize-space()='Sales Matrix']")).click();.
I suspect it may be a locator issue and was considering using JavascriptExecutor, but unsure how to proceed in this scenario.
What steps should I take?