python:使用Selenium2Library库里内部定义的一些方法实例(二)

1.随机选择 select的下拉项

 slice=random.randint(1,57)
 Select(driver.find_element_by_xpath('/html/body/div[2]/div[6]/div/div[2]/div/form/div/div[1]/table/tbody/tr[7]/td[2]/select')).select_by_index(slice)

2.随机勾选一个复选框

slice7=str(random.randint(1,8))
driver.find_element_by_xpath('/html/body/div[2]/div[6]/div/div[2]/div/form/div/div[1]/table/tbody/tr[13]/td[2]/span['+slice7+']/input').click()

猜你喜欢

转载自blog.csdn.net/chenchen879689889/article/details/81168413