I'm trying to prepare python script for one process automatization in selenium. It's my first time when I'm working with xpath and I don't have a clue why this xpath doesn't work.
I got it from chrome webinspect (F12) and clicked on textbox and copy as xpath: '/html/body/div/form/div/div[5]/input[1]' but python says that program cannot find such xpath on a page, could you help me with this?
I also thought that maybe python is trying to check this too fast so I tried to delay it until page will be loaded but it didn't worked.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common import by
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox(executable_path='C:\webdrive\geckodriver.exe')
url= "https://b2b-sso.bmw.com/login/login_b2b.fcc? TYPE=33619969&REALMOID=06-88882215-3ed6-4d48-a202-c1198bb66e4d&GUID=&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=$SM$fF%2fInZ1t%2b%2f1x7LPZ9ZpPr3Jmh3cKinaBuNkYKXWRFpXzW38w4hPWpxtCselZqile&TARGET=$SM$HTTPS%3a%2f%2fb2b%2ebmw%2ecom%2fgroup%2fb2b%3flang%3den"
driver.get(url)
try:
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.xpath('//*[@id="mainContent"]/div[2]/ul/li[2]/a')))
)
finally:
us = driver.find_element_by_xpath('/html/body/div/form/div/div[5]/input[1]')
Could you please advise me how should I resolve it?