Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #96562

Selenium

X-Received by 10.66.194.168 with SMTP id hx8mr12572939pac.19.1442220249780; Mon, 14 Sep 2015 01:44:09 -0700 (PDT)
X-Received by 10.140.40.20 with SMTP id w20mr61788qgw.1.1442220249717; Mon, 14 Sep 2015 01:44:09 -0700 (PDT)
Path csiph.com!xmission!news.glorb.com!kq10no4227408igb.0!news-out.google.com!68ni414qgg.0!nntp.google.com!z77no991382qge.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Mon, 14 Sep 2015 01:44:09 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=14.139.238.98; posting-account=2z6l7woAAAAgv8YY_SbqiC9D55SzPQj9
NNTP-Posting-Host 14.139.238.98
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <25ec8a9e-e5e1-49df-adf7-e6789e500d77@googlegroups.com> (permalink)
Subject Selenium
From shiva upreti <katewinslet626@gmail.com>
Injection-Date Mon, 14 Sep 2015 08:44:09 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.python:96562

Show key headers only | View raw


I wrote this code in python for submitting a login form:

<code>
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()

driver.get('some url')

elem = driver.find_element_by_name("username")
elem.send_keys('13103666')
elem = driver.find_element_by_name("password")
elem.send_keys('as')
driver.find_element_by_name("btnSubmit").click()
#nothing happens from here
print driver.page_source
print "test"
</code>

After clicking on submit button, a message is displayed on the same page whether login was successful or not. 
However after clicking on submit button, I lose control over the web page. I can't use any selenium functions now like 'driver.find_element_by_name()'.

Initially everything works fine. I can enter username and password using selenium as written in my code, but once I click on submit button or press return key(tried both using selenium), any script written after that(involving web driver) doesnt seem to work. Even driver.close() doesnt work.
This is the form I am trying to submit:
<form name="frmHTTPClientLogin" target="_parent" method="post" onsubmit="return checkSubmit();" action="httpclient.html">

The submission is successful, however after submission I cant verify if login was successful or not because of the issue I posted above.
Do I need to switch web handle? If, then how.

Any help will be highly appreciated.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Selenium shiva upreti <katewinslet626@gmail.com> - 2015-09-14 01:44 -0700

csiph-web