Hi I've been trying to fill a number in an input box in Chrome (v 75.0.3770.142) using Selenium Basic ChromeDriver (v 75.0.3770.140) in Excel (2013) VBE
I've tried the below but get error message:
obj.FindElementById("cartPrdQtyBtn0").Value = ("100000")
obj.FindElementByCss("input.form-control.ng-pristine.ng-untouched.ng-
invalid.ng-invalid-required#cartPrdQtyBtn0").SendKeys ("10000")
obj.FindElementByXPath("//input[@class='form-control ng-pristine ng-
untouched ng-invalid ng-invalid-required' and
@id='cartPrdQtyBtn0']").SendKeys ("100000")
(1) HTML before clicking within the input element:
<div class="form-group" ng-class="{'has-error':
(entryItem.invalidProductQuantity || entryItem.invalidPallet ||
entryItem.pumpingQtyError || entryItem.lineItemQtyError)}" ng-
hide="entryItem.isPalletEnabled || entryItem.isCancelled"><!-- ngIf: !entryItem.isDecimal --><input id="cartPrdQtyBtn0" type="text"class="form-control ng-pristine ng-untouched ng-invalid ng-invalid-
required"
restrict="number" restrict-max="100000" required="" ng-
model="entryItem.productDisplayQuantity" ng-
readonly="entryItem.isReadOnly"
ng-blur="updateCartProduct(entryItem, $index)" ng-
if="!entryItem.isDecimal">
<!-- end ngIf: !entryItem.isDecimal -->
<!-- ngIf: entryItem.isDecimal -->
</div>
<p ng-bind="entryItem.productDisplayQuantity" ng-show="entryItem.isCancelled" class="ng-hide"></p>
(2) HTML after clicking within the input element:
<div class="form-group has-error" ng-class="{'has-error':
(entryItem.invalidProductQuantity || entryItem.invalidPallet ||
entryItem.pumpingQtyError || entryItem.lineItemQtyError)}" ng-
hide="entryItem.isPalletEnabled || entryItem.isCancelled">
<!-- ngIf: !entryItem.isDecimal -->
<input id="cartPrdQtyBtn0" type="text"
class="form-control ng-pristine ng-
invalid ng-invalid-required ng-touched" restrict="number" restrict-
max="100000" required="" ng-model="entryItem.productDisplayQuantity" ng-
readonly="entryItem.isReadOnly" ng-blur="updateCartProduct(entryItem,
$index)" ng-if="!entryItem.isDecimal">
<!-- end ngIf: !entryItem.isDecimal -->
<!-- ngIf: entryItem.isDecimal -->
</div>
<p ng-bind="entryItem.productDisplayQuantity" ng-show="entryItem.isCancelled" class="ng-hide"></p>
(3) HTML after sending some text manually (100000):
<div class="form-group" ng-class="{'has-error':
(entryItem.invalidProductQuantity || entryItem.invalidPallet ||
entryItem.pumpingQtyError || entryItem.lineItemQtyError)}" ng-
hide="entryItem.isPalletEnabled || entryItem.isCancelled">
<input id="cartPrdQtyBtn0" type="text" class="form-control ng-pristine
ng-untouched ng-valid ng-valid-required" restrict="number" restrict-
max="100000" required="" ng-model="entryItem.productDisplayQuantity" ng-
readonly="entryItem.isReadOnly" ng-blur="updateCartProduct(entryItem,
$index)" ng-if="!entryItem.isDecimal">
<p ng-bind="entryItem.productDisplayQuantity" ng-show="entryItem.isCancelled" class="ng-hide">100000</p>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…