I'm stumped

60 views
Skip to first unread message

Leo Laskin

unread,
Feb 29, 2012, 9:13:48 AM2/29/12
to seleniu...@googlegroups.com
This may belong on the user list, but I don't think it does, as its a bit more advanced, and I have never been able to get a solid answer in the chat.

I have a page.  It's pretty javascript heavy, but loads for "human" users in a reasonable amount of time(let's say < 1 minute).  However, when a webdriver instance loads it, it takes 20+ minutes to load this one page.  The method that I use to load the page is below(Ruby)

def Sel_Utils.loading?
  sleep_timer = 0
  begin
    while(driver.find_element(:css, ".message"))
    sleep 1
    sleep_timer = sleep_timer + 1;
    if sleep_timer > 500
      sel_log.log("ERROR","Slept way too long waiting for Loading screen")
      sel_log.stop
    end
  end
rescue
  #puts "waited #{sleep_timer} seconds"
  return
end


profile = Selenium::WebDriver::Firefox::Profile.new
profile["dom.max_script_run_time"] = 0
profile["dom.max_chrome_script_run_time"] = 0
profile.log_file = ("C:\\Selenium\\firefox.#{Time.now.strftime("%Y-%m-%d.%H%M%S")}.log")
profile.add_extension("firefox-XPIs/firebug-1.8.4.xpi")
profile["extensions.firebug.currentVersion"] = "9.99"
profile["extensions.firebug.console.enableSites"] = "true"
profile["extensions.firebug.defaultPanelName"] = "console"
profile.add_extension("firefox-XPIs/firepath.xpi")
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 5000 # seconds

driver = Selenium::WebDriver.for :firefox, :profile => profile, :http_client=> client
driver.manage.timeouts.implicit_wait = 3
waiter = Selenium::WebDriver::Wait.new(:timeout => 60)

driver.navigate.to(URL)
#At this point, we are brought to a login page
#Send_Keys and Clickobject are just waits to element.click and element.send_keys without having to find the element.

waiter.until{ driver.find_element(:css, "input[type='password']") }
if user != ''
  Sel_Utils.Send_Keys("id", "username", user)
end
if pass != ''
  Sel_Utils.Send_Keys("css", "input[type='password']",
end
Sel_Utils.ClickObject("css", "input[type='submit']")

Sel_Utils.loading?
while(driver.find_element(:css, ".n-datatable-loading-label").displayed?)
  sleep 2
end
##It stays in this while loop for most of the 20 minutes

Any advice on what Selenium might be doing in the background that would cause the while loop that that is above to take 20 minutes to run

Luke Inman-Semerau

unread,
Feb 29, 2012, 12:18:13 PM2/29/12
to seleniu...@googlegroups.com
Can you provide a reproducible html page or URL? (I'm pretty sure I know, but you may as well state what version of FF and OS you are using).


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

Oscar Rieken

unread,
Feb 29, 2012, 12:46:00 PM2/29/12
to seleniu...@googlegroups.com
does taking out all of the other things going work?
because with all that going on it could be anything from having probems loading the browser extensions to taking forever for the server to respond.

driver = Selenium::WebDriver.for :firefox
driver.navigate.to(URL)
driver.find_element(:id, "whatever_the_username_locator is").send_keys "some_username"
driver.find_element(:css, "input[type='password']").send_keys "something"
driver.find_element(:css, "input[type='submit']").click

Eric Bass

unread,
Jun 4, 2012, 2:20:26 PM6/4/12
to seleniu...@googlegroups.com
I would have to understand more about what happens on the page because the problematic code only checks the presence of the element every 2 seconds.  It is theoretically possible that the page has toggled the css tag in between the two seconds you are waiting before checking the value again.  I would suggest using an expected condition with a webdriverwait or just remove the sleep altogether so the webelement is checked at a shorter interval.  Also, I would make the selector more specific as a simple class query against the whole dom for presence of a single css class entry is probably not the most efficient selector to use.

/Eric
Reply all
Reply to author
Forward
0 new messages