I'm trying to click an element using selenium but for some reason I keep running into this error using Xpath.
from time import sleep
from selenium import webdriver
driver_path = "C:\WebDrivers\chromedriver"
driver = webdriver.Chrome(driver_path)
driver.implicitly_wait(5)
driver.get('https://www.instagram.com/accounts/login/?source=auth_switcher')
sleep(2)
username = driver.find_element_by_name('username')
username.send_keys('YourEmail')
password = driver.find_element_by_name('password')
password.send_keys('YourPassword')
submit =driver.find_element_by_tag_name('form')
submit.submit()
driver.implicitly_wait(15)
explore = driver.find_element_by_xpath('//*[@id="react-root"]/section/nav/div[2]/div/div/div[3]/div/div[4]/a/svg/path')
explore.click()
The issue occurs on my last two lines of code. The Xpath comes from following html line:
<path clip-rule="evenodd" d="M24 0C10.8 0 0 10.8 0 24s10.8 24 24 24 24-10.8 24-24S37.2 0 24 0zm0 45C12.4 45 3 35.6 3 24S12.4 3 24 3s21 9.4 21 21-9.4 21-21 21zm10.2-33.2l-14.8 7c-.3.1-.6.4-.7.7l-7 14.8c-.3.6-.2 1.3.3 1.7.3.3.7.4 1.1.4.2 0 .4 0 .6-.1l14.8-7c.3-.1.6-.4.7-.7l7-14.8c.3-.6.2-1.3-.3-1.7-.4-.5-1.1-.6-1.7-.3zm-7.4 15l-5.5-5.5 10.5-5-5 10.5z" fill-rule="evenodd"></path>
I'm not sure but maybe this has something to do with the fact that it is subcategorized under <svg>
See screenshot: