Jan-15-2018, 12:44 PM
I wrote a script to locate the search bar in my facebook home page. Code for login into my facebook profile using selenium worked perfectly. I got the home page, but the code for locating the search bar is not working correctly. I tried the to locate the search bar using the following code -
elem = driver.find_element_by_name("q")and I am getting the below error message -
Error:/usr/bin/python2.7 /home/csurv_4/PycharmProjects/web_parsing/entering_in_page.py
Traceback (most recent call last):
File "/home/csurv_4/PycharmProjects/web_parsing/entering_in_page.py", line 14, in <module>
elem = driver.find_element_by_name("q")
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 487, in find_element_by_name
return self.find_element(by=By.NAME, value=name)
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 955, in find_element
'value': value})['value']
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [name="q"]
What is the reason of this error? and what is the solution?