回复 2楼 wp231957
from selenium import webdriver
from time import time
from selenium.webdriver.support import ui
from selenium. import By
wb = webdriver.Chrome('D:\python库\chromedriver')
wb.get('https://detail.')
# 判断是否登录
if wb.find_element_by_xpath('/html/body/div[1]/div/div[3]/div[1]'):
# 点击登录按钮
wb.find_element_by_xpath('/html/body/div[1]/div/div[3]/div[1]').click()
# 切入iframe,这里报错!!!!
#
# Message: no such frame: element is not a frame
wb.switch_to.frame(wb.find_element_by_xpath('//*[@id="alibaba-login-iframe"]'))
# 输入用户名和密码
wb.find_element_by_xpath('//*[@id="fm-login-id"]').send_keys('123213')
wb.find_element_by_xpath('//*[@id="fm-login-password"]').send_keys('123123')
# 登录状态
else:
# 选择1080价位
wb.find_element_by_xpath('/html/body/div[2]/div/div[1]/div[1]/div/div[2]/div[3]/div[5]/div[2]/div/div[5]').click()
# 点击选座按钮
wb.find_element_by_xpath('/html/body/div[2]/div/div[1]/div[1]/div/div[2]/div[3]/div[7]/div').click()
wb.close()