Code for Find Element by XPath using Selenium and Python
from selenium import webdriver import time class ExampleHTMLXpath: def testID(self): baseURL = 'https://myfewsteps.blogspot.com/2020/04/selenium-practice.html'
driver = webdriver.Chrome(executable_path='../drivers/chromedriver') driver.get(baseURL) elementXpath = driver.find_element_by_xpath('//*[@id="fname"]') if elementXpath is not None: print('Found XPath element') print(elementXpath) time.sleep(5) cd = ExampleHTMLXpath() cd.testID()