filipefilardi / wpp-broadcaster

Crawler made with Selenium and Python to constantly receive video/audio from target and broadcast to a list of contacts.
MIT License
4 stars 1 forks source link

Some question #2

Closed lddd closed 6 years ago

lddd commented 6 years ago

Hey!

Script is running now but i am not exactly sure how to use it. I am completely new to web automation with selenium.

So do i need to create a empty browser window first go to web.whatsapp.com sign in, or just executing the python script? Executing the python script just opens firefox for me with a blank new window, but can´t see anything happens here.

After some seconds it closes FireFox again with a message "completed.." and i see this

[lddd@CentOS-74-64-minimal ~]# python broadcast.py 
Traceback (most recent call last):
  File "broadcast.py", line 81, in <module>
    crawler.crawl("https://web.whatsapp.com/")
  File "broadcast.py", line 73, in crawl
    self.initialize_webdriver()
  File "broadcast.py", line 32, in initialize_webdriver
    self._driver = webdriver.Firefox(profile)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 162, in __init__
    keep_alive=True)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: connection refused
filipefilardi commented 6 years ago

Hello,

You don't need to open your browser before run. Simple run the script and it will open a new browser for you and connect with whatsapp web.

Unfortunately selenium is in general tricky to set up! Probably that's why you're seeing the white screen.

Before executing my script, can you follow getting started and try to run 2.1 simple usage. If you still see the white screen, the problem is generated by your geckodriver version.

lddd commented 6 years ago

Thanks,

ok the Simple usage example is also just opening a blank browser window. Closing it will bring up this to my console

root@CentOS-74-64-minimal ~]# python simple.py 
Traceback (most recent call last):
  File "simple.py", line 4, in <module>
    driver = webdriver.Firefox()
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py", line 162, in __init__
    keep_alive=True)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status: 0

I am running the following setup. Already tried python 3.6 and some other versions of the gecko driver but still the same, already feel much hate for python and selenium 🗡

filipefilardi commented 6 years ago

Did you try to install this version of selenium?

This problem will persist until you find the proper geckodriver for your firefox, it's anoying but once you get it's amazing!

lddd commented 6 years ago

Thanks. Great news Selenium running now with firefox. Had to downgrade to Selenium 2.5

lddd commented 6 years ago

However there are more issues once connected to WhatsApp Web.

[root@CentOS-74-64-minimal ~]# python broadcast.py Traceback (most recent call last): File "broadcast.py", line 81, in <module> crawler.crawl("https://web.whatsapp.com/") File "broadcast.py", line 75, in crawl self.wait_connection() File "broadcast.py", line 40, in wait_connection EC.presence_of_element_located((By.CLASS_NAME, "intro-title")) File "/usr/lib/python2.7/site-packages/selenium/webdriver/support/wait.py", line 80, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Stacktrace: at FirefoxDriver.prototype.findElementInternal_ (file:///tmp/tmpJX1DYl/extensions/fxdriver@googlecode.com/components/driver-component.js:10770) at fxdriver.Timer.prototype.setTimeout/<.notify (file:///tmp/tmpJX1DYl/extensions/fxdriver@googlecode.com/components/driver-component.js:625) [root@CentOS-74-64-minimal ~]#