last day (15 days later) » 

3:05 PM
0
A: Why does selenium wait for a long time before executing this code?

alecxeSwitching to Chrome() helped me to solve the problem: import time from selenium import webdriver followers_per_page = 18 driver = webdriver.Chrome() driver.get("http://www.quora.com/Programming-Languages/followers") # get the followers count element = driver.find_element_by_class_name('count'...

 
Thank you for looking at the problem. I tried to use chrome by doing this: driver = webdriver.Chrome('/home/asdf/apps/chromedrive/chromedriver') but I get some errors. Updated in the question.
 
@aste123 ok, looks like the path is configured correctly, do you have chrome browser installed?
 
Yes chrome is installed. which gives /usr/bin/google-chrome
 
@aste123 ok, but what if you put path to chromedriver into the PATH env variable? Thanks.
 
I added it to PATH. /home/asdf/apps/chromedrive/chromedriver is shown in echo $PATH. But if I don't pass the path as an argument when creating the instance of Chrome(), I get an not found in path error. And if I pass it, I get the same error as I have mentioned above. Any idea what is wrong?
 
3:05 PM
@aste123 thanks, but what if you put /home/asdf/apps/chromedrive/ to the PATH and use driver = webdriver.Chrome()?
 
It works the same way as passing the path as argument inside the code I guess. Same error as mentioned above.
 
3:49 PM
Hi, sorry I had gone for dinner and hence couldn't see your response.
 
3:59 PM
that's ok
 
Hi
 
hey
 
I'm unable to get it to work.
 
could you try to run that chromedriver executable you've downloaded from the console?
 
hromedriver
Starting ChromeDriver (v2.11.298611 (d1120fdf51badec2f7b63a96e19a58d4783de84d)) on port 9515
Only local connections are allowed.
chromedriver*
 
4:02 PM
hm, not sure what is happening
 
could it be that I'm missing somethign else?
something*
 
could you post the complete code you have at the moment?
also, what selenium version are you using?
 
from selenium import webdriver
import time

#profile = webdriver.FirefoxProfile()
#profile.set_preference("general.useragent.override","Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:28.0) Gecko/20100101 Firefox/28.0")
#driver = webdriver.Firefox(profile)
print 1
driver = webdriver.Chrome()
#driver = webdriver.Firefox()
#driver.set_script_timeout(3)
#driver.set_page_load_timeout(3)

driver.get("http://www.quora.com/Programming-Languages/followers")
#driver.execute_script('window.stop();')
for n in range(0,5): # For testing I have capped this at 5, will handle this properly once things start to work.
Can you tell me how to see the selenium version?
Name: selenium
Version: 2.43.0
That is the latest version I believe
 
okay, let's try this
what is your /etc/hosts file contents?
 
hmm.. the normal one I guess
I don't block anything
Let me check
I have some entries for some ad sites
pointed them to local host
 
4:13 PM
do you have 0.0.0.0 localhost there?
 
127.0.0.1 localhost
127.0.1.1 qwerty-K43SJ
that is the only reference to localhost I can get
I can find*
 
strange error you are getting
it fires up a chromedriver service
and then cannot connect to it
all is on localhost
could you try running the script as sudo?
 
With sudo, I get this error:
sudo python ok.py
1
Traceback (most recent call last):
File "ok.py", line 8, in <module>
driver = webdriver.Chrome()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/webdriver.py", line 59, in __init__
self.service.start()
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/chrome/service.py", line 68, in start
and read up at http://code.google.com/p/selenium/wiki/ChromeDriver")
selenium.common.exceptions.WebDriverException: Message: 'ChromeDriver executable needs to be available in the path. Please download from http://chromedriver.storage.
But it printed 1
So not sure if chrome is not opening at all
 
ok, then try to add that path to the Chrome() explicitly
as you've tried before
but then run the script with sudo
 
It worked :)
 
4:22 PM
hm
 
So what was it ?
 
it has smth to do with resolving that localhost:port and accessing it - I'm not that good at this kind of stuff unfortunately
let me see what I have in hosts
cause I don't need to use sudo
what if you put the following into /etc/hosts commenting out everything else
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
 
Do I have to restart something after that?
Maybe the network service or somethign?
If I do sudo chromedriver
It says command not found
But if I do it without sudo it runs
I think I had installed selenium with sudo
Does it have to do something with this?
 
the latter should not be related to the problem
restart - yeah, I guess
sorry, this part is not really my thing :)
 
ok no problem
atleast I got it to work for now
I will look at it later
Do you want me to try modifying the hosts file now?
You have helped me a lot by the way
Otherwise I would have been wondering what is happening without any clue
 
4:29 PM
thanks
whenever you have time
just let me know in comments if no-sudo option eventually worked for u or not
 
yes ofcourse
for sure
Thank you very much again.
 
most importantly, do you see it scrolling? :)
 
yes
it worked with scrolling
 
good, thank you!
 
thanks :)
 
4:30 PM
see you on SO
 

last day (15 days later) »