Hello Stackoverflow users!
I am trying to automate form submission using Powershell, and Selenium C# webdriver which i just started using a week ago.
As a basic example, I wanted to get all the values from A2 to C2 of an excel sheet below:
and put it into textboxes of a form, then submit it - as seen in this image:
Once it submits, it will then continue to the next row which is A3 to C3, and so on until there is no more value to read on.
So far, this is what i have:
POWERSHELL
$env:PATH += ";c:\selenium" # Adds the path for ChromeDriver.exe to the environmental variable
Add-Type -Path "c:\selenium\WebDriver.dll" # Adding Selenium's .NET assembly (dll) to access it's classes in this PowerShell session
$ChromeDriver = New-Object OpenQA.Selenium.Chrome.ChromeDriver
$ChromeDriver.Url = 'c:\index.html'
$ChromeDriver.FindElementById('fruits').SendKeys('Apple');
$ChromeDriver.FindElementById('vegetables').SendKeys('Pechay');
$ChromeDriver.FindElementById('cars').SendKeys('Honda');
$ChromeDriver.FindElementById('submit').click();
HTML
<input type="text" id="fruits" placeholder="Fruits"><br><br>
<input type="text" id="vegetables" placeholder="Vegetables"><br><br>
<input type="text" id="cars" name="cars" placeholder="Cars"><br><br>
<input type="submit" id="submit" value="Submit">
I would greatly appreciate if someone can help, provide tips, or point me in the right direction.