Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8758163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:28:32+00:00 2026-06-13T14:28:32+00:00

I’m trying out Selenium. I’ve built a quick script using the Selenium IDE. It

  • 0

I’m trying out Selenium. I’ve built a quick script using the Selenium IDE. It logs in to a page, opens up a ‘Search’ window, does a search, and then opens up one of the results.

When I run the test in the Selenium IDE, it works fine. When I export to a Java JUnit 4 test case, it works fine. But when I export to a Python 2 unittest, the xpath searching seems to be very buggy…

Example:

The page has an input element with name=’keyword’. When I search using java with driver.findElement(By.name("keyword")); it’s all good – it finds the element.

When I search using python with browser.find_element_by_name("keyword"), it can’t seem to find it. I’ve also tried browser.find_element_by_xpath("//input[@name='keyword']") and browser.find_element_by_xpath("/html/body/form/div/ul/li[2]/input"), the second of which is the xpath I get when I use firebug and the Copy XPath feature.

I’ve tried adding a delay to the python code before it searches for the input, but to no avail.

Does anyone have any idea why the python calls can’t seem to find the element? This seems to happen with different elements throughout the pages of the web app (but doesn’t happen in the Selenium IDE that I’ve found so far)…

I appreciate any help you guys can provide!

Edit:

The error showing in the console is:

Traceback (most recent call last):
  File "test.py", line 37, in <module>
    elem = browser.find_element_by_xpath("/html/body/form/div/ul/li[2]/input")
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 213, in find_element_by_xpath
    return self.find_element(by=By.XPATH, value=xpath)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 671, in find_element
    {'using': by, 'value': value})['value']
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py", line 156, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 147, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: u'Unable to locate element: {"method":"xpath","selector":"/html/body/form/div/ul/li[2]/input"}'

Cheers

Jarrett

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:28:33+00:00Added an answer on June 13, 2026 at 2:28 pm

    Turns out, the website was opening a new window when a link was clicked, but the driver was still referencing the old window. Not sure why the Selenium IDE export didn’t catch that.

    Anyway, I had to set the window for the driver to the newly opened window, and then it worked ok.

    Hope this might help other people.

    Cheers

    Jarrett

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.