I want to enter Amount value as '123450'(For ex.) in the below url.
Steps -
- Go to URL link
- Click on 'Deposits' on the top menu bar
- Click 'Fixed Deposit >'
- You'll see the Fixed Deposit page with Amount field as 10,000 by default.
I want to change that field and enter any other amount.
Xpath I identified -
//This works when the site loaded for the first time with 10,000 as the default value
@FindBy(xpath = "//div[@class='ieco-blue-underline']/span/b")
WebElement amountField;
//The XPath changes when we enter Amount as '500' <Tab out>..the XPath becomes as per below-
@FindBy(xpath = "//div[@class='ieco-blue-underline']/input")
WebElement amountField;
Do I need to use 1st xpath when entering for the first time..and then use 2nd xpath when I enter values like 500,1000 ?
I have tried 3 ways but none of them worked so far -
public static void sendKeysWithWait(WebElement element, String text){
new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOf(element));
element.click(); element.clear(); //element.sendKeys(Keys.DELETE); element.sendKeys(text); //Pressing Tab key element.sendKeys(Keys.TAB);*/
Actions actions = new Actions(driver); actions.moveToElement(element); actions.click(); actions.sendKeys(text); actions.build().perform(); //Pressing Tab key element.sendKeys(Keys.TAB);
element.click(); JavascriptExecutor jse = (JavascriptExecutor)driver; jse.executeScript("arguments[0].value='2222';", element);
In each of these ways, Click is working..but sendkeys not working. I'm using chromedriver for execution, and Selenium version 3.141.59