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

Issue with automatic web.type() method #40

Open sreekanthac opened 3 years ago

sreekanthac commented 3 years ago

Hello,

I face an issue with web.type(). It is not working on all pages. An example for this is www.airbnb.com. I tried to give the corresponding "id" element names as well. It is not clear how this method is working. Is there any way to provide the "into" or "id" parameters with a list, so that we can initially declare all the possible names as a list and then pass this list as a parameter?

Thanks in advance, Sreekanth

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

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

nateshmbhat commented 3 years ago

@sreekanthac can you please provide a complete code example ?

sreekanthac commented 3 years ago

Hi @nateshmbhat,

Well I cannot share the exact code, but I will provide a sample.

Code Sample -

from webbot import Browser 

page_list = ["www.facebook.com", "www.airbnb.com"]
username = "usrname"
pwd = "pwd"

for page in page_list:
    web = Browser()
    web.go_to(page)
    web.type(username, into='Email', id='Username', multiple=True)
    web.type(pwd, into='Password', id='passwordfieldID', multiple=True)

The above code works fine for facebook, but not for airbnb.

Regards, Sreekanth

nateshmbhat commented 3 years ago

@sreekanthac

Thats because airbnb home page doesn't have those username and password fields. In fact it doesn't have any text input field to type into.

Please check it for airbnb.com/login url. Even this site only one input field (mobile number)

sreekanthac commented 3 years ago

@nateshmbhat If you first click login and then continue with email, you have the option to enter email and pwd. When I inspect the page, I can see the input name = "email" with id ="id" for email entry field. Also for password entry field, I can see name="password" and id="password". All of these are inside input field.

In my code I have added a button. That means only when I click this button it will enter the details in the field. So my idea is first to open this login window and then use the button to enter the login data.

sreekanthac commented 3 years ago

@nateshmbhat Do you have any solution to above issue? Thanks in advance.