登录后,任何请求都会发出Selenium超时

时间:2013-11-25 23:57:45

标签: python selenium

我正在开发一个登录网页然后做很多事情的脚本。 webapge是ML。我使用以下代码登录时没有任何问题:

 def login_ml(self, user, password):

    self.driver.get(self.main_url)

    # li that contains the login
    self.driver.find_element_by_xpath('//li[@id="login"]/a').click()
    self.wait.until(EC.frame_to_be_available_and_switch_to_it("modal-iframe"))

    self.wait.until(EC.visibility_of_element_located((By.ID, "user_id"))).send_keys(user)
    self.driver.find_element_by_id('password').send_keys(password)
    self.driver.find_element_by_id('signInButton').click()
    time.sleep(5)

这个页面有很多AJAX,为此我设置了这个:

self.wait = WebDriverWait(self.driver, 20)

当登录过程完成后,其他任何工作都没有问题,请花太长时间,例如,如果我尝试更改到以下页面:

self.driver.get('http://www.google.com')

需要10或15分钟aprox。

或者这个:

 item = self.driver.find_element_by_id('account')
 item.click()

我不知道该怎么办,我按ID更改为CSS Selectors,Xpath,一切都失败了。就像这个页面冻结所有。我尝试使用AJAX的其他页面并且工作正常,我认为我的问题是这个页面。我使用代理连接。如果有人可以帮助我,请。

0 个答案:

没有答案