Reputation: 1
I use a chrome web-based application. We use bootstrap, which makes it harder to simply right click an element in dev tools and get its xpath or cssselector.
Here is the code of a button I'm trying to click:
div class="pull-right"
button data-bind="click: $root.update, enable: !($root.isLoading() || $root.isRunning()) && workOrderId() > 0, css: {'disabled' : ($root.isLoading() || $root.isRunning() || workOrderId() === 0) }" class="btn btn-primary btn-sm selectorgadget_selected" style="opacity: 0.6;">Calculate</button> == $0
IWebElement applyCalculate = driver.FindElement( By.CssSelector( ".btn-sm" ) );
IWebElement applyCalculate = driver.FindElement( By.CssSelector( ".btn-sm" ) );
try
{
applyCalculate.Click();
{
};
}
catch (Exception)
{
{
};
}
I'm ok either using Classname, cssselector, xpath, pretty much anything that might work at this point. Any ideas? Element is found, but not clicking
Upvotes: 0
Views: 579
Reputation: 1
CODE:
<div class="form-group form-group-sm" data-bind="visible:
!$root.isCollapsed() && !$root.isLocked()"> == $0
::before
<div class="pull-right">
<button data-bind="click: $root.update, enable:!
($root.isLoading() || $root.isRunning()) && workOrderId() > 0,
css: {'disabled' : ($root.isLoading() || $root.isRunning() ||
workOrderId() === 0) }" class="btn btn-primary btn-sm" style=
"opacity: 0.6;">Calculate</button>
</div>
</div>
SCRIPT:
IWebElement applyCalculate = driver.FindElement(By.ClassName(".btn-sm"));
try
{
if (applyCalculate != null)
{
applyCalculate.Click();
applyCalculate.Click();
{
};
}
else
{
{
};
}
}
catch (Exception)
{
}
Upvotes: 0