I have a numerical Textfield. I can fill this Textfield with Sendkeys ...
This is the HTML Code.
HTML-Code:
<input
id="entry-lots"
type="number"
value="1" min="0.01" max="20" step="0.01">
But first i want to clear this Textfield. If i send a *.Clear() it will result in a new value "0.01" ... whatever was inside before.
My Code is:
IWebElement element = webdriver.FindElement(By.Id("entry-lots"));
element.Click();
element.Clear();
element.SendKeys("0.02");
This short lines will result in the Value "0.01002" and not in "0.02" as i need.
Any Ideas to help me out? If interesting: I am using a Windows-Forms Program.
#Edit 1: Start
The Webpage is: https://eas.forexsb.com/
Navigate in the blue Top Line to "Generator" and switch there to "Reactor". Down in the "Reactor" switch to "2. Strategy properties".
The Field "Entry lots" will give my problem.
#Edit 1: End
CodePudding user response:
Using this code you should get the expexted results
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
var driver = new ChromeDriver();
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20);
driver.Navigate().GoToUrl("https://eas.forexsb.com/");
var menu = driver.FindElement(By.XPath("//a[@id='acquisition-toggle']"));
menu.Click();
var reactor = driver.FindElement(By.XPath("//a[@data-name='Reactor']"));
reactor.Click();
var collapse = driver.FindElement(By.XPath("//a[@href='#collapse2']"));
collapse.Click();
var input = driver.FindElement(By.XPath("//input[@id='entry-lots']"));
input.Click();
input.Clear();
input.SendKeys("0.02");