I've always had issues with these two "Calc" buttons, even with Selenium.
I'm using Test Studio and simple left click does not work. I selected to code the step, one method prints errors no click, the other no errors still no click.
By the way, both Calc pictures seen in screenshot attached, have the same code.
1) By Attributes | Result: Error when executing
[CodedStep(@"Desktop command: Calc1yClick")]
public void Calc1yClick()
{
// Desktop command: LeftClick on CalcButtonTag
HtmlControl Calc1yClick = Manager.ActiveBrowser.Find.ByAttributes<HtmlControl>("div class=btn btn-sm btn-primary", "data-bind=click: $root.calc, disable: !$root.isCalcEnabled()", "div class=btn btn-sm btn-primary", "data-bind=click: $root.calc, disable: !$root.isCalcEnabled()", "TextContent=Calc");
Calc1yClick.Click();
}
1) By XPath | Result: Finishes with no errors, but does not click on Calc button
[CodedStep(@"Desktop command: Calc1yClick")]
public void Calc1yClick()
{
// Desktop command: LeftClick on Calc1yClick
HtmlControl Calc1yClick = Manager.ActiveBrowser.Find.ByXPath<HtmlControl>("/html[1]/body[1]/section[1]/div[1]/ul[1]/li[1]/a[1]/button[1]");
Calc1yClick.Click();
}
Actual Code:
<div class="pull-right" data-bind="visible: $root.inputsEnabled()">
<button class="btn btn-sm btn-primary" data-bind="click: $root.calc, disable: !$root.isCalcEnabled()">Calc</button>
</div>
CssSelector extrated from Inspect:
#rorInputsdbf047fe-1781-4f71-8f62-71bea1699aa6 > form > div > div:nth-child(2) > div > button
XPath extracted from Inspect:
//*[@id="rorInputsdbf047fe-1781-4f71-8f62-71bea1699aa6"]/form/div/div[2]/div/button