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

2
  • Are you getting an error? Which one?
    – FDM
    Mar 26, 2016 at 8:50
  • Please show the error(s) and also how you set up driver Mar 26, 2016 at 11:39

2 Answers 2

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')
2
  • care to explain what it will do? Mar 29, 2016 at 1:33
  • share your full code to sort out the problem. Mar 29, 2016 at 6:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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