0

I have to update the Quantity of the product whose element id and name changes with product. eg for Product 1 id="quantity_11046" Product 2 id="quantity_15678"

I am using css as :

WebElement Qty=driver.findElement(By.cssSelector("div:contains(“quantity_1”)");

and

WebElement Qty=driver.findElement(By.cssSelector(""input[id$='quantity_1']");

But getting error unable to find the element.

<div>
<input type="number" maxlength="3" onkeypress="return isNumeric(event)" oninput="maxLengthCheck(this)" min="1" max="999" ng-model="qty" ng-blur="blurred()" ng-change="changed()" ng-disabled="disabled" ng-readonly="readonly" class="ng-pristine ng-untouched ng-valid ng-valid-min ng-valid-max ng-valid-maxlength" name="quantity_11046" id="quantity_11046">
</div>
0

1 Answer 1

1
WebElement Qty=driver.findElement(By.cssSelector("input[id^='quantity_']")); 

worked Thanks

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.