I have webpage where I am trying to login to it. When I use find element by name method to find the elements I get element not interactable error but when i use find element by xpath it works fine and no error. Can anyone explain me why it is not able to interact with element when found by name method?
Same issue is observed for User ID, Password and Login elements. I am sure even when using by name method website is loaded and is ready for use. Below is the screenshot of the Webpage login
My HTML code is as below
Below is the code am using
import xlrd
import openpyxl
import requests
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
from selenium.webdriver.support.ui import Select
from selenium.webdriver.chrome.options import Options
from selenium.webdriver import ChromeOptions, Chrome
opts = webdriver.ChromeOptions()
opts.add_experimental_option("detach", True)
def login_to_Portal(mBrowser):
mBrowser.find_element_by_id("userNameTrucks")
mBrowser.find_element_by_id("userNameTrucks").clear()
mBrowser.find_element_by_id("userNameTrucks").send_keys("xxxxx")
mBrowser.find_element_by_xpath("/html/body/div/router-view/section/div[2]/ul/li[4]/input")
#mBrowser.find_element_by_name("password").clear()
mBrowser.find_element_by_xpath("/html/body/div/router-view/section/div[2]/ul/li[4]/input").send_keys("xxxxx")
mBrowser.find_element_by_xpath("/html/body/div/router-view/section/div[2]/ul/li[5]/button").click()
#mBrowser.find_element_by_class_name("au-target").click()
#mBrowser.find_element_by_name("target")
#mBrowser.find_element_by_name("target").click()
mBrowser = webdriver.Chrome(executable_path = r'C:\chromedriver_win32\chromedriver.exe', options = opts )
mBrowser.get("https://grouptrucksportal.volvo.com/gpp/index.html")
time.sleep(10)
mBrowser.find_element_by_xpath("/html/body/div/compose[1]/section/div[1]/map/area[1]")
mBrowser.find_element_by_xpath("/html/body/div/compose[1]/section/div[1]/map/area[1]").click()
time.sleep(3)
mBrowser.find_element_by_xpath("/html/body/div/compose[3]/section/div[2]/div/ul/li[4]/a")
mBrowser.find_element_by_xpath("/html/body/div/compose[3]/section/div[2]/div/ul/li[4]/a").click()
time.sleep(5)
login_to_Portal(mBrowser)
Now am using xpatha and everything works fine. When i use find element by name it fails with not interactable error