Re: Chrome hangs when trying to find element elements

415 views
Skip to first unread message

Arran

unread,
Jun 6, 2013, 5:07:09 AM6/6/13
to seleniu...@googlegroups.com
Is it any different with the current stable version of ChromeDriver?

(chromedriver_win_26.0.1383.0.zip)

On Wednesday, 5 June 2013 20:13:16 UTC+1, Ben White wrote:
The following code works fine in firefox, but freezes during the call to find element in chrome:

from selenium import webdriver
import time

browser
= webdriver.Chrome()
browser
.implicitly_wait(30)
browser
.get("http://www.google.com")
browser
.find_element_by_id("gbqfq").send_keys("harry potter")
time
.sleep(5)
browser
.find_element_by_id("gb_2").click()
time
.sleep(5)
browser
.quit()

I'm running Win7 64 bit, chrome Version 27.0.1453.110 m, and chromedriver2 0.9 (r202974) (and added to my path), selenium 2.32.0, python 2.7.3.
Since this is my first attempt at using the chrome driver, I'm not sure if I'm missing something or I've found a defect.
The stacktrace seems to vary from execution to execution, I've attached screen shots of a few below:

Divya Maheshwari

unread,
Jun 7, 2013, 6:04:43 AM6/7/13
to seleniu...@googlegroups.com
Hi,

Try to put one small thread.sleep after your get command. It should work out.

Thanks

Mark Collin

unread,
Jun 7, 2013, 6:26:12 AM6/7/13
to seleniu...@googlegroups.com
You should *never* use thread.sleep!

If you need to wait for something to appear use an explicit wait instead.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/f24e0389-0fd7-46fd-a039-c0e1da2a66bd%40googlegroups.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Mark Collin

unread,
Jun 7, 2013, 6:29:02 AM6/7/13
to seleniu...@googlegroups.com
The chromedriver team have now released the official  ChromeDriver 2.0 for support with Chrome 27, you could try that and see how it goes.

Because you have set implicitly wait it will wait for up to 30 seconds every time you try to find an element, mixing that in with your thread.sleep you could be sitting there for 35 seconds before failures if the element can't be found.

How long does it freeze for?

On 06/06/2013 16:40, Ben White wrote:
I'm curious if the script I included above works for anyone else in chrome or if its just me having issues?
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.

Mark Collin

unread,
Jun 10, 2013, 8:31:09 AM6/10/13
to seleniu...@googlegroups.com
Sounds like there may be something not quite right in the latest chromedriver then.  I would suggest you raise a defect

On 07/06/2013 17:01, Ben White wrote:
I'm pretty sure I have the latest driver (found here).

I am aware that it would wait for up to 35 seconds before throwing an exception, however I could leave it for an hour and nothing would happen.
Also, I think its worth noting that the stack trace I linked previously was acquired by using ctrl+c after waiting some time for the function to complete (not sure how else I could do this as I'm somewhat new to python and am not currently using a IDE) and the first two lines ("ERROR:ipc_channel_win.cc(132)" and "ERROR:textfield.h(162)") are printed almost immediately as soon as the script attempts to click on "gb_2", not when I keyboard interrupt the execution like the rest of the trace.

P

unread,
Jun 21, 2013, 3:01:02 AM6/21/13
to seleniu...@googlegroups.com
Is there any defect raised for this? I am also facing the same issue.

Ben White

unread,
Jun 25, 2013, 1:49:00 PM6/25/13
to seleniu...@googlegroups.com
Yes, issue 398 and 400 have been raised with this issue.398, 400

There is a workaround:
Python (Windows):
service_args = ['--log-path=NUL']
browser = webdriver.Chrome(service_args=service_args)

 Python (non-Windows?)
service_args = ['--verbose', '--log-path=/dev/null']
driver = webdriver.Chrome(chrome_options = cr_options, service_args=service_args)

I'm not sure if the --verbose or the chrome_options parts in the non-windows solution are necessary, as it was in the original post, and it  seems that setting  the log-path variable is the actual solution, however I'm not on the team for this project and 398 was not my ticket so it may be. Hope this helps!
Reply all
Reply to author
Forward
0 new messages