我的selenium脚本仅显示find_element_by_css_selector
如何加入find_element_by_id
它抛出属性错误
from selenium import webdriver
import os
import shutil
import sys
import time
import selenium
from selenium.webdriver.common.keys import Keys
import random
options = webdriver.ChromeOptions()
br = webdriver.Chrome(chrome_options=options)
login=br.find_element_by_css_selector('body > div > div > newpage > submitbtn') login.click()
new=br.find_element_by_id('buttonname') new.click()
答案 0 :(得分:0)
由于您不共享HTML,因此很难回答,但您必须使用find_element_by_id
login=br.find_element_by_id('value of id button') login.click()