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

TypeError: 'module' object is not callable #38

Closed TravelTrader closed 3 years ago

TravelTrader commented 4 years ago

I am using the webbot module in many projects. Now I wanted to use it on another system (both Ubuntu 18.04) and with the simple basic code:

import webbot as Browser
import time

web = Browser(showWindow=False)
time.sleep(1)

web.quit()

I do get this error message: TypeError: 'module' object is not callable

Any ideas how to solve it? Thanks a lot.

Update: The same code and much more useful codes are running on other systems of mine. So I am confused what it means. I do not get an error for just using import webbot as Browser.

nateshmbhat commented 3 years ago

can you check with the latest release again ?

TravelTrader commented 3 years ago

I just upgraded webbot again but it does not work. What does the error message mean? Is anything missing on my headless server? Or isn't it possible to use over ssh? Would be great to know the reason behind this error message to find a solution?

Or can you list again the requirements for webbot to work or what requirements are needed to not get this error message?

Thank you!

nateshmbhat commented 3 years ago

Try to follow the below steps :

install Xvfb

sudo apt-get install xvfb

set display number to :99

Xvfb :99 -ac & export DISPLAY=:99

you are now having an X display by Xvfb

Let me know if the above method is working...

TravelTrader commented 3 years ago

Thanks but the same error...

millefalcon commented 3 years ago

I am using the webbot module in many projects. Now I wanted to use it on another system (both Ubuntu 18.04) and with the simple basic code:

import webbot as Browser
import time

web = Browser(showWindow=False)
time.sleep(1)

web.quit()

I do get this error message: TypeError: 'module' object is not callable

Any ideas how to solve it? Thanks a lot.

Update: The same code and much more useful codes are running on other systems of mine. So I am confused what it means. I do not get an error for just using import webbot as Browser.

I recently came across this issue, and another user helped me realize the problem that this is a user error.

They were using it as:

import webbot as Browser.

While they should have been using:

from webbot import Browser.

Hope this helps.

TravelTrader commented 3 years ago

Thanks @millefalcon! That solved the problem. It was just a wrong import from the library.