0

I have been trying to "sendkeys" to a IntegerSpinnerField but it is not working. The IntegerSpinnerField has a id but I can't use the "sendkeys" on it. I opened up the html the ID is there but the IntegerSpinnerField is 3 widgets in 1. So is there anyway i can give an id to the 3 widgets that make up the IntegerSpinnerField.

html-code

<div __gwtcellbasedwidgetimpldispatchingfocus="true" __gwtcellbasedwidgetimpldispatchingblur="true" id="maximumfrequencySpinnerField" class="GJCAMDBBOPB" title="Enter an maximum frequency  value within the allowable range. The allowed range is  776 to 787 MHz" style="width: 100px;"><div style="width: 100px;" class="GJCAMDBBAW"><table width="100%" cellpadding="0" cellspacing="0"><tbody><tr><td><input style="width: 75px;" type="text" value="" class="GJCAMDBBCV GJCAMDBBJV" id="x-auto-229-input" tabindex="0" disabled=""></td><td><div class="GJCAMDBBKV"></div><div class="GJCAMDBBNV"></div></td></tr></tbody></table></div></div>

Id of the textfield which is autogenerated

Hardik Patel
  • 212
  • 2
  • 15

1 Answers1

0

Don't go with id's for ExtJs Applications those were dynamically generated at runtime and prone to change everytime.So you have to write a relative xpath for every element.And ExtJS elements follow some pattern So you have to write xpaths for that and you can reuse them.

Refer any-suggestions-for-testing-extjs-code-in-a-browser-preferably-with-selenium

For your case and for most input element you can find it using label.The immediate input of the label might be the element you are looking for

I have tested the spinner field named Revenue %: in this demo site using the following xpath

 //label[text()='Revenue %:']//following::input

The script for the above site.Hope it helps

 WebDriver driver = new FirefoxDriver();
    driver.get("https://www.sencha.com/examples/#ExamplePlace:dashboard");
    WebElement element=driver.findElement(By.xpath("//label[text()='Revenue %:']//following::input"));
    element.clear();
    element.sendKeys("67.67");
Community
  • 1
  • 1
Madhan
  • 5,750
  • 4
  • 28
  • 61