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 bel
To send a character sequence within the input field you can use either of the following Locator Strategies:
cssSelector
:
obj.FindElementByCss("input.form-control.ng-pristine.ng-untouched.ng-invalid.ng-invalid-required[id^='cartPrdQtyBtn']").Click
obj.FindElementByCss("input.form-control.ng-pristine.ng-invalid.ng-invalid-required.ng-touched[id^='cartPrdQtyBtn']").SendKeys("10000")
xpath
:
obj.FindElementByXPath("//input[@class='form-control ng-pristine ng-untouched ng-invalid ng-invalid-required' and starts-with(@id, 'cartPrdQtyBtn')]").Click
obj.FindElementByXPath("//input[@class='form-control ng-pristine ng-invalid ng-invalid-required ng-touched' and starts-with(@id, 'cartPrdQtyBtn')]").SendKeys("10000")
Note: As it is a dynamic element you need to induce a waiter for the element to be clickable
You can find a couple of relevant discussions in:
finally figured out that it works with the div class also in front:
obj.FindElementByXPath("//div[@class='form-group']/input[@class='form-control ng-pristine ng-untouched ng-invalid ng-invalid-required'and @id= 'cartPrdQtyBtn0']").SendKeys ("100000")