'vba Selenium form filling from Excel sheet in chrome
I am new to selenium VBA but have managed to write some code to take data from Excel Sheet and fill in a webform by logging in and sending data to input boxes. This works successfully as long as the order of data input boxes matches my excel sheet, with varying amounts of data to be filled in. I need to find the element of the input box inside a macro with something like " driver.findelementbyxpath("' contains text'") to make sure a specific text box is found before filling in the data rather than just in order of one text input box after another.Often the order of my excel sheet does not match the order of the form frustratingly .
Below is the code I have and below that is the inspection of the code for the element I am looking for
drv.FindElementByXPath("//*[@id='PurchaseItemGrid']/tbody/tr[" & X & "]/td/div[1]/div[2]/div[2]/table/tbody/tr[2]/td[31]/input").SendKeys(OrderArray(CODEROW, 1)).Value
here is the inspection of the element I require
input type="number" item="882214" branch="1" layer="26" pallet="6" class="form-control orderInputBox text-right" value="">
enter image description hereI essentially need to pass in an item variable (in this case 882214) and a branch number (1 here) to find the element I am looking for and match it to my excel sheet to drop in the value I need to fill out the form .Hopefully this would find the correct input box on the webform before populating data
thanks in advance to anyone who can help on this
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
