python auto complete not working for webelement

1,093 views
Skip to first unread message

darrell

unread,
Mar 19, 2011, 10:22:26 AM3/19/11
to webdriver
Greetings,

I recently joined a company who want to use Python to program Selenium
RC. In the past I have used Java and Eclipse to program Selenium. I
haven't had to spend time looking up APIs in years because auto
completion works flawlessly with Java.

Now that I have switched to Python I'm finding that auto completion is
not working. If I enter object dot then wait with standard Python
library elements it works great. I get a list of the methods and
variables available to that object. However, it does not work for
selenium objects. For example,

from selenium import webdriver

# Below, when I enter the . it gives me a list of methods available to
webdriver.
driver = webdriver.Firefox()
driver.get("http://www.google.ca")
input = driver.find_element_by_name("q")

# At this point everything is working fine.
# Below if I enter input. it display a list of methods which aren't
relative to a webelement
# Here is the full list of suggested methods:

input.__call__
input.__class__
input.__cmp__
input.__delattr__
input.__doc__
input.__eq__
input.__format__()
input.__ge__
input.__getattribute__
input.__gt__
input.__hash__
input.__init__
input.__le__
input.__lt__
input.__module__
input.__name__
input.__ne__
input.__new__(S, ___)
input.__reduce__()
input.__reduce_ex__()
input.__repr__
input.__self__
input.__setattr__
input.__sizeof__()
input.__str__
input.__subclasshook__()

I have even tried using:


from selenium.webdriver.common.by import By

input = driver.find_element(By.NAME, "q")

and input. does not do proper auto completion. It just seems to be the
Selenium APIs. Using time, re, sys, etc. works fine. Using selenium
and webdriver works but webelement does not. Is this a configuration
issue or a problem with how the Selenium Python code is laid out?

Aculo

unread,
Mar 21, 2011, 2:37:54 PM3/21/11
to webdriver
Hi Darell,

I have the same problem with EasyEclipse + Selenium 2.0b2 Webdriver +
Python 2.7.

My test coding (just using the page of a german webshop) fills out the
the input forms, but the autocomplete won't work for webelement
functions, like send_keys and click.

Do you or anybody knows, if there is an API documentation for the
Python Webdriver? I have only found a API docu for Java.

My test coding:
----------------------
import unittest,time

from selenium import webdriver


class AlternateTests (unittest.TestCase):
def setUp(self):
self.sUserName = "justasel...@google.com"
self.sPW = "test123"

self.driver = webdriver.Firefox()
self.driver.get("http://www.alternate.de")
print "Title: " +self.driver.title

def testWrongLogin(self):
self.inputUser =
self.driver.find_element_by_name("loginUserName")
self.inputPW =
self.driver.find_element_by_name("loginPassword")
self.submitButton =
self.driver.find_element_by_id("miniLoginButton")

self.inputUser.send_keys(self.sUserName)
self.inputPW.send_keys(self.sPW)

self.submitButton.click()
time.sleep(5)

def tearDown(self):
self.driver.quit()

if __name__ == "__main__":
unittest.main()
-------------------------------------------
Greetings
Aculo
----------------------------------------------------------

darrell

unread,
Mar 22, 2011, 12:49:54 PM3/22/11
to webdriver
I got epydoc (http://epydoc.sourceforge.net/) and generated my own
docs for Selenium Python.

On Mar 21, 2:37 pm, Aculo <acul...@hotmail.com> wrote:
> Hi Darell,
>
> I have the same problem with EasyEclipse + Selenium 2.0b2 Webdriver +
> Python 2.7.
>
> My test coding (just using the page of a german webshop) fills out the
> the input forms, but the autocomplete won't work for webelement
> functions, like send_keys and click.
>
> Do you or anybody knows, if there is an API documentation for the
> Python Webdriver? I have only found a API docu for Java.
>
> My test coding:
> ----------------------
> import unittest,time
>
> from selenium import webdriver
>
> class AlternateTests (unittest.TestCase):
>     def setUp(self):
>         self.sUserName = "justaseleniumt...@google.com"

Aculo

unread,
Mar 24, 2011, 1:47:25 PM3/24/11
to webdriver
With 'driver.create_web_element' auto completion worked for me. But I
don't know if this is the right way...
-----------------------------------------------------
from selenium import webdriver

driver = webdriver.Firefox()
driver.get("http://www.alternate.de")

we1 = driver.create_web_element(1)
inputUser = we1.find_element_by_name("testuser")
inputPW = we1.find_element_by_name("1234")
-----------------------------------------------------

darrell

unread,
Mar 25, 2011, 10:07:49 AM3/25/11
to webdriver
The auto complete for the WebDriver element is working for me. If you
try auto complete for inputUser or inputFW the auto complete feature
doesn't work for me.
Reply all
Reply to author
Forward
0 new messages