-
As I read the documentation it should be possible to search within an element, so you don't search the entire dom...
Did I miss something, can somebody help? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
What are the errors you're seeing? The more details you can provide, the better |
Beta Was this translation helpful? Give feedback.
-
In theory, yes, but I need more context. Can you provide the website or
HTML that you're querying? The xpath you're using doesn't look "good" to
me, so there may be a better solution
…On Wed, Dec 4, 2024, 5:25 AM Vhyseris ***@***.***> wrote:
There is no error.
The problem is, that this code returns the first input of the dom, which
is outside of the row and the table in general.
It should return me the first input inside of tr, right?
—
Reply to this email directly, view it on GitHub
<#342 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFQDCPKB77BWY25PVOTD6NL2D3YEFAVCNFSM6AAAAABSMKRCXCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNBWGA3TSOI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
It's just an simple example html, to test the search within elements...
The thing is, that i will not have ids for html elements and have to search over not ideal xpaths, because websites could be generated dynammically... |
Beta Was this translation helpful? Give feedback.
-
Okayyy, thanks to ChatGPT and the right question I found out what the problem was. Its not a problem with the pylenium code, but you need to know if your searching within an element over XPath, you need to add a dot at the beginning! Here, the dot (.) ensures the XPath starts from the parent element instead of the root of the DOM. This approach ensures scoped searches, avoiding performance hits and ensuring the intended element is found more accurately. Corrected code
May I suggest to add this info to this section of the documentation: @ElSnoMan |
Beta Was this translation helpful? Give feedback.
Okayyy, thanks to ChatGPT and the right question I found out what the problem was.
Its not a problem with the pylenium code, but you need to know if your searching within an element over XPath, you need to add a dot at the beginning! Here, the dot (.) ensures the XPath starts from the parent element instead of the root of the DOM. This approach ensures scoped searches, avoiding performance hits and ensuring the intended element is found more accurately.
Corrected code
May I suggest to add this info to this section of the documentation:
https://docs.pylenium.io/eleme…