Automating filling in online form in Edge using Selenium within VBA but I am receiving an error message when trying to use the SendKeys for Enter. Note, there is not submit button, Enter is required.
Sub Login()
'Open online trading platform
Dim obj As New WebDriver
obj.Start "edge", ""
obj.Get "https://standard.tradezeroweb.us/"
obj.Wait 1000
obj.Window.Maximize
obj.FindElementById("trading-order-input-symbol").Clear
obj.FindElementById("trading-order-input-symbol").SendKeys ("AAPL")
obj.FindElementById("trading-order-input-symbol").SendKeys (Keys.Enter) 'This is where the code fails
End Sub
Sendkeys (Keys.Enter) returns:
Run-time error '424': Object required
Using obj.FindElementById("trading-order-input-symbol").SendKeys ("AAPL").submit returns:
Run-time error '7': NoSuchElementError
Using obj.FindElementByXPath("//*[@id=trading-order-input-symbol]").SendKeys (obj.Key.Enter) returns:
Run-time error '438': Object doesn't support this property or method
Looking for some assistance and what could be going wrong.
Assuming the "trading-order-input-symbol" element exists then the problem with
obj.FindElementById("trading-order-input-symbol").SendKeys (Keys.Enter)(that results in the error 424) is thatKeysdoes not exist by default ... it must be declared.So, before that line, add a line
Dim Keys As New Selenium.Keys.For info, based on the error you are having, I would guess you do not have
Option Explicitat the top of your Module. This is 'hiding' the problem ... you should always useOption Explicit. If you add this (without adding theDim Keys As New Selenium.Keysline) and compile your project, the VBE will tell you that 'Keys' is not defined - giving you a clue as to what the problem was.