Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ui] improved way to combine locateAll() with a filter #1123

Closed
ptrthomas opened this issue Apr 29, 2020 · 4 comments
Closed

[ui] improved way to combine locateAll() with a filter #1123

ptrthomas opened this issue Apr 29, 2020 · 4 comments
Assignees

Comments

@ptrthomas
Copy link
Member

triggered by discussion here: https://stackoverflow.com/q/61478511/143475

first, the Element is missing the chainable attribute(name) method

the proposal is to make it easier to extract an element which is hard to "isolate" via a css selector

something like this:

def list = locateAll('div[data-label]', "_.getAttribute('data-label').startsWith('myQues1_1')")
@ptrthomas ptrthomas added this to the 0.9.6 milestone Apr 29, 2020
@ptrthomas ptrthomas self-assigned this Apr 29, 2020
@iamDrachir
Copy link

Hi @ptrthomas, really appreciate your help! I am able to automate DocuSign page with the code that you provided me in the discussion above. Btw aside from "startsWith", could we add "contains" and "endsWith"? Just thinking that we might come across future use case for them. Thank you!

@ptrthomas
Copy link
Member Author

@iamDrachir thanks. actually the good thing is any JS method can be used. I suggest you get familiar with what happens here, Karate will execute that JS in the browser - explained here: https://github.com/intuit/karate/tree/master/karate-core#karate-vs-the-browser

so in short, you can use includes() and endsWith() - it will just work.

@ptrthomas ptrthomas added the fixed label May 3, 2020
ptrthomas added a commit that referenced this issue May 3, 2020
ptrthomas added a commit that referenced this issue May 3, 2020
@ptrthomas
Copy link
Member Author

finally implemented as karate-JS predicate, see readme edits for details: https://github.com/intuit/karate/tree/develop/karate-core#locateall-with-filter

@ptrthomas
Copy link
Member Author

0.9.6 released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants