python
selenium录制的脚本界面可以控制播放的快慢,把录制的脚本导入到python中怎么设置运行的快慢, python不会控制脚本执行的快慢,一般都是有多快就多快,一条条语句执行下去如果你想要看清执行的效果,加个延迟:time.sleep(3) 若尘_51 发表于 2016-10-17 14:48
python不会控制脚本执行的快慢,一般都是有多快就多快,一条条语句执行下去
如果你想要看清执行的效果,加 ...
这个延迟是没执行完语段语句就要加? 15889369825 发表于 2016-10-17 15:06
这个延迟是没执行完语段语句就要加?
执行语句的后面,例如:打开新页面,在语句加个等待,让所有页面元素加载完成后,再执行下一个语句 若尘_51 发表于 2016-10-17 15:54
执行语句的后面,例如:打开新页面,在语句加个等待,让所有页面元素加载完成后,再执行下一个语句
谢谢!只是这样比较麻烦, 15889369825 发表于 2016-10-17 17:18
谢谢!只是这样比较麻烦,
def test_(self):
driver = self.driver
import time
driver.get(self.base_url + "/adminlogin")
driver.find_element_by_id("email").clear()
driver.find_element_by_id("email").send_keys("2@163.com")
driver.find_element_by_id("password").clear()
driver.find_element_by_id("password").send_keys("123456")
driver.find_element_by_id("submit").click()
driver.find_element_by_link_text(u"企业管理").click()
driver.find_element_by_link_text(u"高级查找").click()
driver.find_element_by_id("verified").click()
driver.find_element_by_xpath("//div[@id='inner-group']/div/label").click()
driver.find_element_by_id("forbidden").click()
driver.find_element_by_id("btn-search2").click()
driver.find_element_by_id("verified").click()
driver.find_element_by_id("to-verified").click()
driver.find_element_by_css_selector("label.checkbox-label").click()
driver.find_element_by_id("btn-search2").click()
driver.find_element_by_css_selector("i.i_pg_r").click()
driver.find_element_by_link_text(">").click()
driver.find_element_by_id("forbidden").click()
driver.find_element_by_xpath("//div[@id='inner-group']/div/label").click()
driver.find_element_by_id("verified").click()
driver.find_element_by_xpath("//div[@id='inner-group']/div/label").click()
driver.find_element_by_id("btn-search2").click()
driver.find_element_by_id("forbidden").click()
driver.find_element_by_id("btn-search2").click()
driver.find_element_by_id("company-num").clear()
driver.find_element_by_id("company-num").send_keys("0H78")
driver.find_element_by_id("btn-search2").click()
time_sleep(3)
driver.find_element_by_id("company-num").clear()
driver.find_element_by_id("company-num").send_keys("0H76")
driver.find_element_by_id("btn-search2").click()
time_sleep(3)
driver.find_element_by_id("company-num").clear()
driver.find_element_by_id("company-num").send_keys("0H")
driver.find_element_by_id("btn-search2").click()
time_sleep(3)
driver.find_element_by_id("company-num").clear()
driver.find_element_by_id("company-num").send_keys("0H7")
driver.find_element_by_id("btn-search2").click()
time_sleep(3)
driver.find_element_by_id("company-num").clear()
driver.find_element_by_id("company-num").send_keys("0H8")
driver.find_element_by_id("btn-search2").click()
time_sleep(3)
driver.find_element_by_id("company-num").clear()
driver.find_element_by_id("company-num").send_keys("0H6")
driver.find_element_by_id("btn-search2").click()
time_sleep(3)
driver.find_element_by_id("company-name").clear()
driver.find_element_by_id("company-name").send_keys(u"水")
driver.find_element_by_id("btn-search2").click()
time_sleep(3)
driver.find_element_by_id("company-name").clear()
driver.find_element_by_id("company-name").send_keys(u"赛蓝")
driver.find_element_by_id("btn-search2").click()
time_sleep(3)
这样插入提示没有找到time_sleep对象 15889369825 发表于 2016-10-17 17:58
def test_(self):
driver = self.driver
import time
time_sleep(3)??? 应该是time.sleep(3) 若尘_51 发表于 2016-10-18 08:53
time_sleep(3)??? 应该是time.sleep(3)
在另一个脚本中写成time_sleep(3) 一样运行了
页:
[1]