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

exists(id=' ') method always returns True #42

Closed revshell0 closed 3 years ago

revshell0 commented 3 years ago

@nateshmbhat The exists() method with any constructor inside it, always returns True despite entering random values.

You can try this code snippet. It always returns True.

from webbot import Browser

driver = Browser()
driver.go_to('https://github.com/login')

print(driver.exists(id='1234qwerty'))
print(driver.exists(css_selector='input[name="8888888"]'))
print(driver.exists(xpath='//input[@id="asdfg"]'))

Could you please check and fix this bug? My QA code makes extensive use of 'exists()' method. It will be very helpful. Thanks.

issue-label-bot[bot] commented 3 years ago

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.93. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

nateshmbhat commented 3 years ago

Hey can you check if this is happening in previous versions of webbot ?

On Thu, Jul 30, 2020, 11:42 PM issue-label-bot[bot] < notifications@github.com> wrote:

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.93. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage https://github.com/marketplace/issue-label-bot, dashboard https://mlbot.net/data/nateshmbhat/webbot and code https://github.com/hamelsmu/MLapp for this bot.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nateshmbhat/webbot/issues/42#issuecomment-666574531, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFRTSNQNGWHN3VRF2ONPMNTR6GZ2PANCNFSM4POKTSTQ .

nateshmbhat commented 3 years ago

Can you check if this is happening in previous versions of webbot?

nateshmbhat commented 3 years ago

You can use the driver object directly.

web.driver.find_element_by_id()

There are methods on the driver object to find element by ID, css and XPath.

revshell0 commented 3 years ago

@nateshmbhat What I had originally written was not a bug. That's the intended behaviour. I misunderstood it.

The exists() method expects a text as an argument and that text is actually the name of the element itself and NOT the value present within the element.

Meaning, driver.exists('username', id='username') checks whether 'username' is infact the name of the element with 'username' id. That's how you check whether an element exists or not.

Cheers!