user-defined methods in Selenium

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

user-defined methods in Selenium

Tony Chamberlain
Is there any way to make user-defined Selenium methods?  For instance, in the version of Selenium we use there is no ends-with().  So I have to do something like
//input[substring(@id, string-length(@id) - string-length('_PHONE$1') +1) = '_PHONE$1'] instead of //input[ends-with('_PHONE$1')].

So if I could do something like (and this is just an example):

define my-ends-with(String endsWith) {
     substring(@id, string-length(@id) - string-length(endsWith) +1) = endsWith
}
I am using Java and Eclipse and Chrome and Selenium.  The selenium version is the one with Chrome that does not have an ends-with().
Chrome == 67.0.3396.87
Java 1.8

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/7e7b4610-fea0-4e1f-89d5-2ea15034b601%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.