botasaurus icon indicating copy to clipboard operation
botasaurus copied to clipboard

Need xpath support

Open M-Zubair10 opened this issue 1 year ago • 6 comments

Hello there

It will be cool if we can include xpath also along with css selector in most of the methods like wait_for_element

M-Zubair10 avatar Jun 07 '24 21:06 M-Zubair10

I also open a new topic to try to find how to use selenium WebDriver method.

stevenhubhub avatar Jun 17 '24 22:06 stevenhubhub

I agree. XPath is a must.

Aduomas avatar Jun 20 '24 20:06 Aduomas

Yes, it's necessary for complex logic

StillNoob avatar Jun 25 '24 12:06 StillNoob

true

hukhho avatar Jan 16 '25 05:01 hukhho

You can get around this by using .select() function provided by Botasaurus to get the desired HTML block and then using the lxml library specify the XPath you want. Here is an example:

from lxml import html

html_content = driver.select(' desired HTML block') tree = html.fromstring(html_content) output = tree.xpath('your xpath')

Boudy601 avatar Feb 04 '25 14:02 Boudy601