51Testing软件测试论坛
标题:
提示错误: TypeError: open() missing 1 required positional argument: 'url'
[打印本页]
作者:
测试积点老人
时间:
2021-8-4 13:10
标题:
提示错误: TypeError: open() missing 1 required positional argument: 'url'
封装:
from selenium import webdriver
def brower(type_):
try:
driver = getattr(webdriver, type_)()
except:
driver = webdriver.Chrome()
return driver
class web_ui:
# driver = webserver.Chrome()
# 构造函数
def __init__(self, type_):
self.driver = brower(type_)
# 打开url
def open(self, url):
self.driver.get(url)
# 元素定位
def locator(self, value):
return self.driver.find_element(value)
# 点击
def click_(self, name, value):
self.locator(name, value).click()
# 输入
def send_(self, name, value, txt):
self.locator(name, value).send_keys(txt)
# 退出
def quit_(self):
self.driver.quit()
# 等待
def sleep_(self, value=10):
self.driver.implicitly_wait(value)
调用:
from selenium1.web_ui import web_ui
web_ui('Chrome')
web_ui.open('http://www.baidu.com')
提示错误:
TypeError: open() missing 1 required positional argument: 'url'
复制代码
作者:
bellas
时间:
2021-8-5 09:43
参考下这个链接
https://blog.csdn.net/qq_34785659/article/details/104640040
作者:
qqq911
时间:
2021-8-5 10:59
少传一个变量
作者:
litingting0214
时间:
2021-8-5 14:01
https://blog.csdn.net/qq_34785659/article/details/104640040
参考下这篇文章
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2