首页 > 解决方案 > Looking to automate seller login portal with Python and Selenium , find xPath

问题描述

I am looking for xPath for the image that I am inserting.

Below is the code that I wrote, everything is working except click on Login Button.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
browser = webdriver.Chrome('C:\\Users\\byteMe\\Downloads\\chromedriver_win32\chromedriver')
browser.get('https://seller.abc.com/')
browser.find_element_by_id('Final').click()
browser.find_element_by_name('username').send_keys('byteme@gmail.com')
browser.find_element_by_name('password').send_keys('byteme')
browser.find_element_by_xpath("//*[@'button']").click()
browser.get('https://seller.abc.com/index.html#dashboard/listings-management?listingState=ACTIVE')

Inspect element code

enter image description here

标签: pythonseleniumxpath

解决方案


请尝试以下代码以单击登录按钮

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


submit=WebDriverWait(browser, 10).until(
EC.visibility_of_element_located((By.XPATH, "//button[@class='sc-aewfc iesYjz']//span")))
submit.click()

推荐阅读