Forums

Selenium on Hacker Account

Hey guys, how r u ?

I activate a hacker account today and i'm having some troubles.

I uploaded a django project yesterday when i was a free account, and this django has a selenium and "parse" the HTML of google (scrapping algorithm).

I tested the code and worked fine, but when i try to use this code in my project, the error "can't find the element name "q"' occurs every time.

Do i need to clone my project again to recognize that my profile is a hacker or there are something to do about it ?

thanks a lot !!

Have a look at the content of the page that you're getting back so you can work out why it's not finding the element that you expect.

hey glenn, i run only the script that makes the scrapping and run very well, there were no mistakes.... and the tags in the web page are good (look for name='g' on google page)... i don't know what is wrong with my code...

I meant look at the content of the response you're getting in the script. What google looks like to your browser and what it looks like to your script may be entirely different.

i think i was doing something wrong... thanks for helping me.

I was trying to use get() method on selenium, but it happens something weard.

that's the code of the error.

  File "/home/renanmascg/CrawlingFinal/crawling/harvesting.py", line 133, in harvestingMain
    browser.get('http://www.google.com.br')
  File "/home/renanmascg/.virtualenvs/myenv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 248, in get
    self.execute(Command.GET, {'url': url})
  File "/home/renanmascg/.virtualenvs/myenv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 234, in execute
    response = self.command_executor.execute(driver_command, params)
  File "/home/renanmascg/.virtualenvs/myenv/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 401, in execute
    return self._request(command_info[0], url, body=data)
  File "/home/renanmascg/.virtualenvs/myenv/lib/python3.5/site-packages/selenium/webdriver/remote/remote_connection.py", line 433, in _request
    resp = self._conn.getresponse()
  File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse
    response.begin()
  File "/usr/lib/python3.5/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.5/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

why does it happen ? i followed the tutorial which you have at the site for selenium

[edited by admin: formatting]

Did you recently upgrade? And are you running this as a console script? If so make sure you have killed any old consoles before you run it again?