Good morning everyone. I wrote this code in VBA to log into a website. I would like to do the exact same thing but using selenium. Is this possible? The reason I want to reference a cell for user name and password is because multiple people will be using this sub and I don't want one persons username/password to be embedded in the code and therefore can't use sendkeys
. Here is the VBA code
'Search DOM for element by ID and input username
Set HTMLDoc = IE.Document
Set HTMLInput = HTMLDoc.getElementById("userName")
HTMLInput.Value = Worksheets("Sheet1").Range("B3").Text
CodePudding user response:
Do you want to get the value of a cell in Excel only using selenium and implement automation? If this is the case, then this is impossible, because selenium can only operate the browser, and to get the value in excel only through VBA code.
If you use VBA, you can combine them. Add Selenium Type Library
in Reference
. Then you can write code to achieve your automation needs. Simply refer to this thread.
CodePudding user response:
Found the Solution:
'Input Username (Cells(row, column).value)
Ch.FindElementByName("userName").SendKeys (Cells(3, 2).Value)