2

Below is my website content

<input type="text" title="Query for bugs (&quot;Go box&quot;) [Alt-K]"
       name="Go" id="GoText" size="23"
       onkeypress="GoBoxKeypress(event)" onblur="GoBoxBlur(event)" 
       onfocus="GoBoxFocus(event)" onclick="GoBoxKeypress(null)" 
       class="filter" accesskey="k" value="">

i wanted to access the text field i have tried below things

abc=driver.find_element_by_id('GoText')
a=driver.find_element_by_name('go')

but still I am not able to access the element

  • Are you getting an error? Which one? – FDM Mar 26 '16 at 8:50
  • Please show the error(s) and also how you set up driver – Michael Durrant Mar 26 '16 at 11:39
1

The selectors seem ok.
There may be something wrong in your setup.
Please show how driver is being defined and how you are pointing at the page in question.

For example please show lines similar to:

driver = webdriver.Firefox()
driver.get("http://www.yoursite.org")

Are you getting NoSuchElementException ?

What if you try driver.find_element(By.XPATH, '//input') do you get anything or an error?

See also http://selenium-python.readthedocs.org/locating-elements.html

0

If you are using def, try this:

def test_1(self):
    abc=self.driver.find_element_by_id('GoText')
  • care to explain what it will do? – IAmMilinPatel Mar 29 '16 at 1:33
  • share your full code to sort out the problem. – user3388005 Mar 29 '16 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.