B4J Question [pdn_selenium] FindElement...

Cableguy

Expert
Licensed User
Longtime User
Hi guys, I guess this one is for our HTML expert users...

I have this input field in a form:

<input type="text" name="name" placeholder="Email address / account name">

I can interact with it by using
B4X:
    Dim LoginForm As Object = Selenium.FindByClassName("","formV2") 'this is my form
    
    Dim Login As Object = Selenium.FindByClassName(LoginForm, "input") 'this works, but why???
    Selenium.WebElementSendKeys(Login, "pendrush")

I need to next interact with

<input type="password" name="password" placeholder="Password">

which is part of the same form... but I just can't "find" it!!

Any hints??
 
Solution
First update library and check examples:
B4X:
 Dim LoginForm As Object
is
B4X:
 Dim LoginForm As Pnd_WebElement

Explanation of your code:

"LoginForm As Object" is FORM tag and everything inside <form> </form>
"Dim Login As Object" is INPUT field inside <form> </form> tag. Login is a child WebElement of his parrent WebElement LoginForm.

It is much more easier to update library and use new classes and properties.

Not tested code, with updated library:
B4X:
Dim LoginForm As Pnd_WebElement = Selenium.FindByClassName("formV2")
Dim Login As Pnd_WebElement = LoginForm.FindByName("name")       '  searching for name="name" inside LoginForm WebElement
Dim Pass As Pnd_WebElement = LoginForm.FindByName("password")    '  searching for...

Pendrush

Well-Known Member
Licensed User
Longtime User
First update library and check examples:
B4X:
 Dim LoginForm As Object
is
B4X:
 Dim LoginForm As Pnd_WebElement

Explanation of your code:

"LoginForm As Object" is FORM tag and everything inside <form> </form>
"Dim Login As Object" is INPUT field inside <form> </form> tag. Login is a child WebElement of his parrent WebElement LoginForm.

It is much more easier to update library and use new classes and properties.

Not tested code, with updated library:
B4X:
Dim LoginForm As Pnd_WebElement = Selenium.FindByClassName("formV2")
Dim Login As Pnd_WebElement = LoginForm.FindByName("name")       '  searching for name="name" inside LoginForm WebElement
Dim Pass As Pnd_WebElement = LoginForm.FindByName("password")    '  searching for name="password" inside LoginForm WebElement
Login.SendKeys("MyUsername")
Pass.SendKeys("MyPassword")
 
Last edited:
Upvote 0
Solution

Cableguy

Expert
Licensed User
Longtime User
Hi @Pendrush

I have updated the lib... I really thought I had the latest, since I downloaded it late december...

Still, I have no such definition is current v0.98 for pnd_WebElement



I will try to continue my testing...
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
indeed... has the drivers also changed??
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
I just re-downloaded library and i can see all classes.
Try to download again.
Close B4J, and then extract ZIP to additional lib folder and then run B4J.
Its look like you have old Pnd_Selenium.xml file.
 
Upvote 0

Pendrush

Well-Known Member
Licensed User
Longtime User
indeed... has the drivers also changed??
Explanation is on the bottom of the page:
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
are these the correct ones?

 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
ok, thank you... I just also downloaded the exemples bundle...
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
And it already seem easier to use!!! a big thank you....
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…