1

So I declared an integer. And I have an input field. And I want to use whatever I have stored in the integer as value for that input field. Is it possible?

Here is the code, with the ideal ending:

int avPartQty = Integer.parseInt(avPartQty_substring);
actions.searchResultsVa_SelectAvailPartQty(driver).sendKeys(+avPartQty); //wish it was that easy, lol.

This is my text box:

<input name="txtQty" value="1" maxlength="5" id="txtQty" class="textboxnumeric" onkeypress="return ValidateForDecimal(this, event);" style="color:Black;width:25px;" type="text">
4
  • Why not use .sendKeys(avPartQty_substring)? Commented Jul 9, 2015 at 22:52
  • Will converting the int to string help or you want to send that as int? Commented Jul 9, 2015 at 23:04
  • you can simply pass sendKeys(String.valueOf(avPartQty));. Commented Jul 10, 2015 at 6:00
  • Read the question carefully. My problem is not how to convert int to strings. I needed the WebDriver method on how to use an int as input for a field, which someone already put below. Thanks! Commented Jul 10, 2015 at 16:32

1 Answer 1

2

you can use below code for this,

int avPartQty = Integer.parseInt(avPartQty_substring); actions.searchResultsVa_SelectAvailPartQty(driver).sendKeys(avPartQty+"");

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.