硒javascript代码如何单击?

enter image description here

网站:data.go.kr

from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys

chromedriver = 'C:/Users/B0114/Downloads/chromedriver_win32/chromedriver.exe'
driver = webdriver.Chrome(chromedriver)

driver.get('http://www.data.go.kr/tcs/dss/selectDataSetList.do')

elem = driver.find_element_by_xpath('//a[@href="#tab_layer02"]')
elem.click()

lloyd = driver.find_elements_by_xpath("//a[@href='javascript:void(0)']")

for ll in range(5):
    lloyd[ll].click()
    time.sleep(2)
评论
  • znon
    znon 回复

    如果要使用带硒的javascript单击元素,可以执行以下操作:

    driver.execute_script('arguments[0].click();', element)