nateshmbhat / webbot

Web automation library for simple and easy end to end testing and web browser automation that offers super charged features while keeping it simple to use and master
https://pypi.org/project/webbot/
Mozilla Public License 2.0
239 stars 87 forks source link

find_elements returning too many things? #36

Closed doubledrat closed 4 years ago

doubledrat commented 4 years ago

it's probably me not understanding how this is supposed to work, but if I issue the following javascript

document.querySelectorAll('div[class^=addressContainer]')

I get 3 elements returned

If I do this in webbot, I get 64

w.find_elements(css_selector='div[class^=addressContainer]')

However if I do this

w.driver.find_elements_by_css_selector('div[class^=addressContainer]')

it returns 3 elements

what am I doing wrong?

nateshmbhat commented 4 years ago

There is a loose_match = True parameter which defaults to true. Try making it false and check.

nateshmbhat commented 4 years ago

If you want to run css query selector , then you can directly use the driver object from the webbot instance.

web = Browser()
web.driver.find_element_by_css_selector("div[class^=addressContainer]")