Selenium自动化框架控制页面

def run(driver, url):
    try:
        driver.get(url)
        time.sleep(3)
        cls = driver.find_elements_by_xpath('//font[contains(text(),"0.00%")]')
        cls[0].click()
        time.sleep(1)

        line = driver.find_element_by_xpath('//div[@class="x-grid3-row-checker"]')
        ActionChains(driver).context_click(line).perform()
        time.sleep(1)

        add = driver.find_element_by_xpath('//span[contains(text(), "添加文件批注")]')
        add.click()
        time.sleep(1)

        mudol = driver.find_element_by_xpath('//textarea[contains(@name, "模块")]').send_keys('dc')
        jianyi = driver.find_element_by_xpath('//input[contains(@name, "开发分析建议")]').send_keys('无需改进')
        button_click = driver.find_element_by_xpath('//button[contains(text(), "确定")]').click()
        time.sleep(1)
        qd2 = driver.find_elements_by_xpath('//button[contains(text(), "确定")]')
        qd2[1].click()
    except Exception as e:
        print(e)
        return

你可能感兴趣的:(Selenium自动化框架控制页面)