from selenium import webdriver
import time
driver=webdriver.Chrome()
driver.get('xxxxxx')
# 输入/点击
# driver.find_element('xpath','//*[@id="kw"]').send_keys('狗子')
# driver.find_element('xpath','//*[@id="su"]').click()
time.sleep(10)
dd = driver.find_element('xpath','//*[@id="app"]/div/div/section/div/div[2]/main/div[4]/div[3]/div/img')
# 滑动至元素可见
driver.execute_script('window.scrollBy()')
driver.execute_script("arguments[0].scrollIntoView();",dd)
# 进入多商城
dd.click()
time.sleep(3)
# 点击商品
driver.find_element('xpath','//span[text()="商品"]').click()
time.sleep(3)
# 点击商品管理
driver.find_element('xpath','//span[text()="商品管理"]').click()
time.sleep(3)
# 点击商品ID输入框,输入商品ID进行搜索,并点击查询
driver.find_element('xpath','//input[@placeholder="请输入商品ID"]').send_keys('8aaaf23d7fbfe542017fe97ce1fa7536')
driver.find_element('xpath','//span[text()="查询"]').click()
time.sleep(3)
# 重置输入框
driver.find_element('xpath','//span[text()="重置"]').click()
time.sleep(3)
# 选择商品状态搜索,点击状态下拉框
driver.find_element('xpath','//input[@class="el-select__input is-medium"]').click()
time.sleep(3)
# 选择状态
driver.find_element('xpath','//li[@class="el-select-dropdown__item"]/div[text()="已上架"]').click()
time.sleep(3)
# 点击查询
driver.find_element('xpath','//span[text()="查询"]').click()
time.sleep(2)
# 重置输入框
driver.find_element('xpath','//span[text()="重置"]').click()
|