B4J Question Pnd_Selenium input string

ElliotHC

Active Member
Licensed User
Hi,

I've tabbed to a text input field using pnd_selenium and I need to know how to enter a string, does anyone have an example of doing this?

I expect to use
  • WebElementSendKeys (WebElement As org.openqa.selenium.WebElement, Keys As String)
    Use this method to simulate typing into an element, which may set its value.
    See W3C WebDriver specification for more details.
    Params: Keys – character sequence to send to the element

However, I don't see what I put before the string. WebElement As org.openqa.selenium.WebElement.

I've checked and can't see any examples of this being used.

Thanks
 
Last edited:

ElliotHC

Active Member
Licensed User
The answer was not obvious but it seems you can't just input test on the focused element. You have to specify the element by name. I've used it's ID.

On my web page the ID of the element is 'userInput', so you use:


Private Selenium as Pnd_Selenium (for example)

Dim WebElement1 As Object = Selenium.FindByIdWebElement("userInput")
Selenium.WebElementSendKeys(WebElement1, "Text I would like to Input")

I hope this is helpful for anyone else.
 
  • Like
Reactions: byz
Upvote 0
Top