我是靠谱客的博主 执着斑马,最近开发中收集的这篇文章主要介绍pythonfor循环嵌套_python中for循环嵌套了if条件后无法循环了,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106#进入固定资产管理

Chrome_Drive.find_element_by_id("6C8B27A16FA246D69780EE638FBB3D6A").click()

time.sleep(1)

fa_lists=Chrome_Drive.find_element_by_xpath("//*[@id='6C8B27A16FA246D69780EE638FBB3D6A']").find_elements_by_class_name('category-Name')

#综合查询部分

for fa_model in fa_lists:

fa_model.click()

time.sleep(1)

a_buttons=Chrome_Drive.find_element_by_class_name("appList").find_elements_by_tag_name("a")

for a in a_buttons:

a.click()

time.sleep(1)

Chrome_Drive.switch_to_window(Chrome_Drive.window_handles[1])

time.sleep(1)

tables_sheet=Chrome_Drive.find_element_by_id("app-nav").find_element_by_tag_name("ul").find_elements_by_tag_name("li")

# table依次测试顺序为:综合查询、资产基础管理、资产业务查询、资产盘点管理

for table in tables_sheet:

table.click()

time.sleep(1)

Chrome_Drive.switch_to_frame("mainFrame")

Chrome_Drive.switch_to_window(Chrome_Drive.window_handles[1])

time.sleep(1)

print(table.text)

#测试项目

if table.text=='资产业务查询':

time.sleep(1)

Chrome_Drive.switch_to_frame("mainFrame")

time.sleep(1)

#搜索框测试

orderNumber=Chrome_Drive.find_element_by_xpath("//*[@id='list']/tbody/tr[1]/td[3]/a").text

print(orderNumber)

Chrome_Drive.find_element_by_css_selector("[name='keySearch']").send_keys(orderNumber)

time.sleep(1)

Chrome_Drive.find_element_by_class_name("click_input_icon").click()

time.sleep(1)

Chrome_Drive.find_element_by_xpath("//*[@id='list']/tbody/tr[1]/td[3]/a").click()

time.sleep(1)

Chrome_Drive.switch_to_window(Chrome_Drive.window_handles[2])

Chrome_Drive.find_element_by_xpath("//*[@id='closeWindow']/a/span").click()

time.sleep(1)

Chrome_Drive.switch_to_window(Chrome_Drive.window_handles[1])

Chrome_Drive.switch_to_frame("mainFrame")

time.sleep(1)

Chrome_Drive.find_element_by_css_selector("[name='keySearch']").clear()

time.sleep(1)

Chrome_Drive.find_element_by_class_name("click_input_icon").click()

time.sleep(1)

#条件测试-申请人

Chrome_Drive.find_element_by_id("uiid-2459469583305846_open").click()

Chrome_Drive.implicitly_wait(2) # 因为弹出的窗口是通过js新增的div模块,所以要设置等待后,待页面加载后重新获取Chrome_Drive的页面元素才能定位

Chrome_Drive.switch_to_window(Chrome_Drive.window_handles[1])

iframe=Chrome_Drive.find_element_by_xpath("//*[@id='topdialog_uiid-2459469583305846']/div[2]/iframe")

Chrome_Drive.switch_to_frame(iframe)

Chrome_Drive.find_element_by_xpath("//*[@id='tree']/ul/li/ul/li[6]/span/a").click()

Chrome_Drive.find_element_by_xpath("//*[@id='tree']/ul/li/ul/li[6]/ul/li[7]/span/a").click()

Chrome_Drive.find_element_by_xpath("//*[@id='tree']/ul/li/ul/li[6]/ul/li[7]/ul/li[1]/span/a").click()

Chrome_Drive.find_element_by_xpath("//*[@id='ok']/a").click()

#清空还原,重新加载框架

Chrome_Drive.implicitly_wait(2)

Chrome_Drive.switch_to_window(Chrome_Drive.window_handles[1])

Chrome_Drive.switch_to_frame("mainFrame")

Chrome_Drive.find_element_by_xpath("//*[@id='btnClearQuery']/a").click()

Chrome_Drive.implicitly_wait(2)

Chrome_Drive.switch_to_window(Chrome_Drive.window_handles[1])

Chrome_Drive.switch_to_frame("mainFrame")

time.sleep(2)

#流程状态选择测试,清空条件

Chrome_Drive.find_element_by_xpath("//*[@id='uiid-9333555011841209']/div[1]/a").click()

time.sleep(2)

Chrome_Drive.find_element_by_xpath("/html/body/div[3]/div/a[2]").click()

Chrome_Drive.implicitly_wait(2)

Chrome_Drive.switch_to_window(Chrome_Drive.window_handles[1])

Chrome_Drive.switch_to_frame("mainFrame")

Chrome_Drive.find_element_by_xpath("//*[@id='btnClearQuery']/a").click()

Chrome_Drive.implicitly_wait(2)

Chrome_Drive.switch_to_window(Chrome_Drive.window_handles[1])

Chrome_Drive.switch_to_frame("mainFrame")

time.sleep(2)

#申请部门测试,清空条件

Chrome_Drive.find_element_by_id("uiid-20383743069464813_open").click()

Chrome_Drive.implicitly_wait(2)

Chrome_Drive.switch_to_window(Chrome_Drive.window_handles[1])

iframe=Chrome_Drive.find_element_by_xpath("//*[@id='topdialog_uiid-20383743069464813']/div[2]/iframe")

Chrome_Drive.switch_to_frame(iframe)

time.sleep(2)

Chrome_Drive.find_element_by_xpath("//*[@id='tree']/ul/li/ul/li[6]/span/a").click()

time.sleep(2)

Chrome_Drive.find_element_by_xpath("//*[@id='ok']/a").click()

time.sleep(2)

Chrome_Drive.implicitly_wait(2)

Chrome_Drive.switch_to_window(Chrome_Drive.window_handles[1])

Chrome_Drive.switch_to_frame("mainFrame")

Chrome_Drive.find_element_by_xpath("//*[@id='btnClearQuery']/a").click()

elif table.text=="固定资产情况表":

print("固定资产情况表")

else:

print("资产卡片查询")

最后

以上就是执着斑马为你收集整理的pythonfor循环嵌套_python中for循环嵌套了if条件后无法循环了的全部内容,希望文章能够帮你解决pythonfor循环嵌套_python中for循环嵌套了if条件后无法循环了所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(90)

评论列表共有 0 条评论

立即
投稿
返回
顶部