Python中文
首页
教程
问答
标签
搜索
登录
注册
从另一个python-fi执行selenium测试用例
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我试图从python文件执行selenium测试用例。 我知道可以使用python的subprocess模块来实现这一点,但是我想探讨调用testcase函数的可能性。在</p> <p>这是我的密码</p> <h2>chrome_设置_测试.py在</h2> <pre><code>from selenium import w ebdriver from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException import unittest, time, re import os, shutil, sys from selenium.webdriver.chrome.options import Options from selenium import webdriver class SeleniumException(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome() self.driver.implicitly_wait(30) #self.driver = nested_selenium.driver self.base_url = "https://www.google.co.in/" self.verificationErrors = [] def test_selenium_exception(self): driver = self.driver driver.get(self.base_url + "/") driver.find_element_by_id("gbqfq").clear() driver.find_element_by_id("gbqfq").send_keys("Check this out") def is_element_present(self, how, what): try: self.driver.find_element(by=how, value=what) except NoSuchElementException, e: return False return True def tearDown(self): self.driver.quit() self.assertEqual([], self.verificationErrors) if __name__ == "__main__": unittest.main() </code></pre> <h2>硒_财务执行.py在</h2> ^{pr2}$
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>如果希望能够直接调用SeleniumException类的方法,可以实例化它。在</p> <pre><code>import chrome_settings_test print "going to call" my_test = chrome_settings_test.SeleniumException() my_test.setUp() </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
如何在python中从数据帧列中删除分类值?
3 回答
如何在python中从数据帧列表中删除引号
6 回答
如何在python中从数据帧创建列表
8 回答
如何在Python中从数据帧创建嵌套的JSON
2 回答
如何在Python中从数据帧显示wordcloud
1 回答
如何在Python中从数据帧的时间戳中删除字符
1 回答
如何在Python中从数据帧绘制简单绘图?
4 回答
如何在python中从数据帧行提取具有特定长度的范围?
2 回答
如何在python中从数据帧设置dict中的值
2 回答
如何在Python中从数据库中获得一个结果
3 回答
如何在python中从数据框中绘制分类条形图
10 回答
如何在Python中从数据框中选择特定细节?
2 回答
如何在python中从数据集中删除unicode
4 回答
如何在python中从数据集中删除某些数值?
8 回答
如何在python中从数据集中选择行
2 回答
如何在Python中从数组中删除元素
10 回答
如何在python中从数组中删除单个倒逗号?
8 回答
如何在python中从数组中删除对象?
10 回答
如何在python中从数组中删除引号
7 回答
如何在python中从数组中删除所有最小值
3 回答