I'm creating a simple selenium script to enter username and password to log in. Here is my code:
driver = webdriver.Chrome(executable_path=r'C:\\Users\\Aspire5\\Downloads\\chromedriver_win32\\chromedriver.exe')
driver.get("https://ven02207.service-now.com/")
username = driver.find_element_by_xpath('//*[@id="user_name"]')
username.send_keys('username')
password = driver.find_element_by_xpath('//*[@id="user_password"]')
password.send_keys('this_is_password')
But I'm getting following exception:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="user_name"]"}
I'm accessing this website from code. The XPath I've provided in code are exists on the page, but still it's returning No Such Element Exception.
What I'm missing here? I've seen this, this questions for this, but couldn't find exact answer.