如何解决如何使用 selenium IDE python 输出?
我已经测试了一个 selenium 测试来从 selenium IDE
中的网站下载文件。然后我将此测试导出为 python 脚本。
但我不知道如何在 python 代码中使用这个脚本。
这是输出脚本:
# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
class Test201401():
def setup_method(self,method):
self.driver = webdriver.Chrome()
self.vars = {}
def teardown_method(self,method):
self.driver.quit()
def test_201401(self):
time.sleep(10000)
self.driver.get("LINK to My Download")
self.driver.set_window_size(550,691)
time.sleep(5000)
elements = self.driver.find_elements(By.ID,"kc-form")
assert len(elements) > 0
self.driver.find_element(By.ID,"username").click()
self.driver.find_element(By.ID,"username").send_keys("myusername")
self.driver.find_element(By.ID,"password").send_keys("mypasswor")
self.driver.find_element(By.ID,"kc-login").click()
time.sleep(5000)
我已经在 Windows 中安装了 pytest
和 selenium
by pip3
。运行此脚本后没有任何反应。没有错误,没有下载!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。