How to use element_click method in AutoItDriverServer

Best Python code snippet using AutoItDriverServer_python

FaXianPageClass.py

Source:FaXianPageClass.py Github

copy

Full Screen

...24 self.log.info('[action_start]发现模块添加附近机友操作流程执行开始')25 try:26 #进入发现模块27 self.driver.wait_for_element(self.FX_eleloc['element_fx'],10)28 self.driver.element_click(self.FX_eleloc['element_fx'])29 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'],10)30 self.log.info('[action]发现模块进入成功')31 #进入找机友32 self.driver.wait_for_element(self.FX_eleloc['element_fx_jy'],10)33 self.driver.element_click(self.FX_eleloc['element_fx_jy'])34 self.driver.wait_for_element(self.FJJY_eleloc['element_fjjy_title'],10)35 self.log.info('[action]找机友模块进入成功')36 #添加机友37 self.driver.wait_for_element(self.FJJY_eleloc['element_fjjy_fjjy'],10)38 self.driver.element_click(self.FJJY_eleloc['element_fjjy_fjjy'])39 time.sleep(2)40 self.driver.one_of_elements_click(self.FJJY_eleloc['elements_fjjy_jy_list'],2)41 self.driver.wait_for_element(self.FJJY_eleloc['element_fjjy_jy_title'],10)42 self.driver.wait_for_element(self.FJJY_eleloc['element_fjjy_jy_add'],10)43 self.driver.element_click(self.FJJY_eleloc['element_fjjy_jy_add'])44 self.driver.wait_for_element(self.FJJY_eleloc['element_fjjy_jy_add_input'],10)45 self.driver.element_click(self.FJJY_eleloc['element_fjjy_jy_add_input'])46 self.driver.element_sendkeys(self.FJJY_eleloc['element_fjjy_jy_add_input'],self.datas['FJJY_pl'])47 self.driver.element_click(self.FJJY_eleloc['element_fjjy_jy_add_ok'])48 self.driver.wait_for_element(self.FJJY_eleloc['element_fjjy_jy_title'],10)49 self.log.info('[action]添加机友请求发送成功,添加机友内容为【{}】'.format(self.datas['FJJY_pl']))50 self.log.info('[action]即将返回发现模块')51 #返回发现模块52 self.driver.element_click(self.FJJY_eleloc['element_fjjy_jy_goback'])53 self.driver.wait_for_element(self.FJJY_eleloc['element_fjjy_title'],10)54 self.driver.element_click(self.FJJY_eleloc['element_fjjy_goback'])55 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'],10)56 self.log.info('[action]返回发现模块成功')57 self.log.info('[action_result]发现模块添加附近机友操作流程执行成功')58 self.log.info('[action_end]发现模块添加附近机友操作流程执行结束')59 self.log.info('---------------------------------------------------------')60 except Exception as e:61 self.log.error('[action_error]发现模块添加附近机友操作流程执行失败.')62 self.log.error('[action_error]错误原因为{}'.format(e))63 self.driver.get_screenshot_image('发现模块添加附近机友')64 self.log.info('[get_image]失败场景已截图,请于{}进行查看'.format(image_path))65 self.log.info('---------------------------------------------------------')66 raise67 def action_psjb_sj(self):68 '''发现模块-PS奖杯时间分类-评论'''69 self.log.info('[action_start]发现模块PS奖杯时间分类评论流程操作执行开始')70 try:71 # 进入发现模块72 self.driver.wait_for_element(self.FX_eleloc['element_fx'], 10)73 self.driver.element_click(self.FX_eleloc['element_fx'])74 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'], 10)75 self.log.info('[action]发现模块进入成功')76 #进入ps奖杯77 self.driver.wait_for_element(self.FX_eleloc['element_fx_yxjb'],10)78 self.driver.element_click(self.FX_eleloc['element_fx_yxjb'])79 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_title'],10)80 self.log.info('[action]PSN游戏奖杯模块进入成功')81 #进入时间ps奖杯82 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_sj'],10)83 self.driver.element_click(self.PSJB_eleloc['element_jb_sj'])84 self.driver.wait_for_one_of_eles(self.PSJB_eleloc['elements_jb_gm_list'], 0, 10)85 self.driver.one_of_elements_click(self.PSJB_eleloc['elements_jb_gm_list'],0)86 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jblist_title'],10)87 self.log.info('[action]PSN游戏奖杯模块时间分类模块游戏奖杯进入成功')88 #选择一个奖杯进行评论89 self.driver.one_of_elements_click(self.PSJB_eleloc['elements_jb_gm_jblist'],1)90 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jbxq'],10)91 self.log.info('[action]游戏奖杯详情进入成功')92 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_fbpl'],10)93 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl'])94 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_fbpl_input'],10)95 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl_input'])96 self.driver.element_sendkeys(self.PSJB_eleloc['element_jb_gm_fbpl_input'],self.datas['PSJB_sj_pl'])97 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl_ok'])98 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jbxq'],10)99 self.log.info('[action]奖杯评论成功,评论内容为【{}】'.format(self.datas['PSJB_sj_pl']))100 self.log.info('[action]即将返回发现模块')101 #返回发现模块102 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_jbxq_goback'])103 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jblist_title'],10)104 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_goback'])105 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_title'],10)106 self.driver.element_click(self.PSJB_eleloc['element_jb_goback'])107 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'],10)108 self.log.info('[action]返回发现模块成功')109 self.log.info('[action_result]发现模块PS奖杯时间分类评论流程执行成功')110 self.log.info('[action_end]发现模块PS奖杯时间分类评论流程执行结束')111 self.log.info('---------------------------------------------------------')112 except Exception as e:113 self.log.error('[action_error]发现模块PS奖杯时间分类评论流程执行失败.')114 self.log.error('[action_error]错误原因为{}'.format(e))115 self.driver.get_screenshot_image('发现模块PS奖杯时间分类评论')116 self.log.info('[get_image]失败场景已截图,请于{}进行查看'.format(image_path))117 self.log.info('---------------------------------------------------------')118 raise119 def action_psjb_fs(self):120 '''发现模块-PS奖杯分数分类-评论'''121 self.log.info('[action_start]发现模块PS奖杯分数分类评论流程操作执行开始')122 try:123 # 进入发现模块124 self.driver.wait_for_element(self.FX_eleloc['element_fx'], 10)125 self.driver.element_click(self.FX_eleloc['element_fx'])126 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'], 10)127 self.log.info('[action]发现模块进入成功')128 #进入ps奖杯129 self.driver.wait_for_element(self.FX_eleloc['element_fx_yxjb'],10)130 self.driver.element_click(self.FX_eleloc['element_fx_yxjb'])131 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_title'],10)132 self.log.info('[action]PSN游戏奖杯模块进入成功')133 #进入时间ps奖杯134 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_fs'],10)135 self.driver.element_click(self.PSJB_eleloc['element_jb_fs'])136 self.driver.wait_for_one_of_eles(self.PSJB_eleloc['elements_jb_gm_list'],0,10)137 self.driver.one_of_elements_click(self.PSJB_eleloc['elements_jb_gm_list'],0)138 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jblist_title'],10)139 self.log.info('[action]PSN游戏奖杯模块分数分类模块游戏奖杯进入成功')140 #选择一个奖杯进行评论141 self.driver.one_of_elements_click(self.PSJB_eleloc['elements_jb_gm_jblist'],1)142 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jbxq'],10)143 self.log.info('[action]游戏奖杯详情进入成功')144 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_fbpl'],10)145 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl'])146 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_fbpl_input'],10)147 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl_input'])148 self.driver.element_sendkeys(self.PSJB_eleloc['element_jb_gm_fbpl_input'],self.datas['PSJB_fs_pl'])149 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl_ok'])150 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jbxq'],10)151 self.log.info('[action]奖杯评论成功,评论内容为【{}】'.format(self.datas['PSJB_fs_pl']))152 self.log.info('[action]即将返回发现模块')153 #返回发现模块154 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_jbxq_goback'])155 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jblist_title'],10)156 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_goback'])157 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_title'],10)158 self.driver.element_click(self.PSJB_eleloc['element_jb_goback'])159 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'],10)160 self.log.info('[action]返回发现模块成功')161 self.log.info('[action_result]发现模块PS奖杯分数分类评论流程执行成功')162 self.log.info('[action_end]发现模块PS奖杯分数分类评论流程执行结束')163 self.log.info('---------------------------------------------------------')164 except Exception as e:165 self.log.error('[action_error]发现模块PS奖杯分数分类评论流程执行失败.')166 self.log.error('[action_error]错误原因为{}'.format(e))167 self.driver.get_screenshot_image('发现模块PS奖杯分数分类评论')168 self.log.info('[get_image]失败场景已截图,请于{}进行查看'.format(image_path))169 self.log.info('---------------------------------------------------------')170 raise171 def action_psjb_wjs(self):172 '''发现模块-PS奖杯玩家数分类-评论'''173 self.log.info('[action_start]发现模块PS奖杯玩家数分类评论流程操作执行开始')174 try:175 # 进入发现模块176 self.driver.wait_for_element(self.FX_eleloc['element_fx'], 10)177 self.driver.element_click(self.FX_eleloc['element_fx'])178 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'], 10)179 self.log.info('[action]发现模块进入成功')180 #进入ps奖杯181 self.driver.wait_for_element(self.FX_eleloc['element_fx_yxjb'],10)182 self.driver.element_click(self.FX_eleloc['element_fx_yxjb'])183 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_title'],10)184 self.log.info('[action]PSN游戏奖杯模块进入成功')185 #进入时间ps奖杯186 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_wjs'],10)187 self.driver.element_click(self.PSJB_eleloc['element_jb_wjs'])188 self.driver.wait_for_one_of_eles(self.PSJB_eleloc['elements_jb_gm_list'],0,10)189 self.driver.one_of_elements_click(self.PSJB_eleloc['elements_jb_gm_list'],0)190 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jblist_title'],10)191 self.log.info('[action]PSN游戏奖杯模块玩家数分类模块游戏奖杯进入成功')192 #选择一个奖杯进行评论193 self.driver.one_of_elements_click(self.PSJB_eleloc['elements_jb_gm_jblist'],1)194 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jbxq'],10)195 self.log.info('[action]游戏奖杯详情进入成功')196 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_fbpl'],10)197 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl'])198 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_fbpl_input'],10)199 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl_input'])200 self.driver.element_sendkeys(self.PSJB_eleloc['element_jb_gm_fbpl_input'],self.datas['PSJB_wjs_pl'])201 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl_ok'])202 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jbxq'],10)203 self.log.info('[action]奖杯评论成功,评论内容为【{}】'.format(self.datas['PSJB_wjs_pl']))204 self.log.info('[action]即将返回发现模块')205 #返回发现模块206 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_jbxq_goback'])207 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jblist_title'],10)208 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_goback'])209 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_title'],10)210 self.driver.element_click(self.PSJB_eleloc['element_jb_goback'])211 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'],10)212 self.log.info('[action]返回发现模块成功')213 self.log.info('[action_result]发现模块PS奖杯玩家数分类评论流程执行成功')214 self.log.info('[action_end]发现模块PS奖杯玩家数分类评论流程执行结束')215 self.log.info('---------------------------------------------------------')216 except Exception as e:217 self.log.error('[action_error]发现模块PS奖杯玩家数分类评论流程执行失败.')218 self.log.error('[action_error]错误原因为{}'.format(e))219 self.driver.get_screenshot_image('发现模块PS奖杯玩家数分类评论')220 self.log.info('[get_image]失败场景已截图,请于{}进行查看'.format(image_path))221 self.log.info('---------------------------------------------------------')222 raise223 def action_psjb_nd(self):224 '''发现模块-PS奖杯难度分类-评论'''225 self.log.info('[action_start]发现模块PS奖杯难度分类评论流程操作执行开始')226 try:227 # 进入发现模块228 self.driver.wait_for_element(self.FX_eleloc['element_fx'], 10)229 self.driver.element_click(self.FX_eleloc['element_fx'])230 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'], 10)231 self.log.info('[action]发现模块进入成功')232 #进入ps奖杯233 self.driver.wait_for_element(self.FX_eleloc['element_fx_yxjb'],10)234 self.driver.element_click(self.FX_eleloc['element_fx_yxjb'])235 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_title'],10)236 self.log.info('[action]PSN游戏奖杯模块进入成功')237 #进入时间ps奖杯238 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_nd'],10)239 self.driver.element_click(self.PSJB_eleloc['element_jb_nd'])240 self.driver.wait_for_one_of_eles(self.PSJB_eleloc['elements_jb_gm_list'],0,10)241 self.driver.one_of_elements_click(self.PSJB_eleloc['elements_jb_gm_list'],0)242 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jblist_title'],10)243 self.log.info('[action]PSN游戏奖杯模块难度分类模块游戏奖杯进入成功')244 #选择一个奖杯进行评论245 self.driver.one_of_elements_click(self.PSJB_eleloc['elements_jb_gm_jblist'],1)246 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jbxq'],10)247 self.log.info('[action]游戏奖杯详情进入成功')248 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_fbpl'],10)249 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl'])250 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_fbpl_input'],10)251 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl_input'])252 self.driver.element_sendkeys(self.PSJB_eleloc['element_jb_gm_fbpl_input'],self.datas['PSJB_nd_pl'])253 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_fbpl_ok'])254 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jbxq'],10)255 self.log.info('[action]奖杯评论成功,评论内容为【{}】'.format(self.datas['PSJB_nd_pl']))256 self.log.info('[action]即将返回发现模块')257 #返回发现模块258 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_jbxq_goback'])259 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_gm_jblist_title'],10)260 self.driver.element_click(self.PSJB_eleloc['element_jb_gm_goback'])261 self.driver.wait_for_element(self.PSJB_eleloc['element_jb_title'],10)262 self.driver.element_click(self.PSJB_eleloc['element_jb_goback'])263 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'],10)264 self.log.info('[action]返回发现模块成功')265 self.log.info('[action_result]发现模块PS奖杯难度分类评论流程执行成功')266 self.log.info('[action_end]发现模块PS奖杯难度分类评论流程执行结束')267 self.log.info('---------------------------------------------------------')268 except Exception as e:269 self.log.error('[action_error]发现模块PS奖杯难度分类评论流程执行失败.')270 self.log.error('[action_error]错误原因为{}'.format(e))271 self.driver.get_screenshot_image('发现模块PS奖杯难度分类评论')272 self.log.info('[get_image]失败场景已截图,请于{}进行查看'.format(image_path))273 self.log.info('---------------------------------------------------------')274 raise275 def action_psph_dj(self):276 '''发现模块-PS排行榜-通过等级查看玩家信息'''277 self.log.info('[action_start]发现模块PS排行榜等级分类查看玩家信息流程操作执行开始')278 try:279 # 进入发现模块280 self.driver.wait_for_element(self.FX_eleloc['element_fx'], 10)281 self.driver.element_click(self.FX_eleloc['element_fx'])282 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'], 10)283 self.log.info('[action]发现模块进入成功')284 # 进入ps排行榜285 self.driver.wait_for_element(self.FX_eleloc['element_fx_ph'], 10)286 self.driver.element_click(self.FX_eleloc['element_fx_ph'])287 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_title'], 10)288 self.log.info('[action]PS排行榜模块进入成功')289 #进入等级-玩家信息界面290 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_dj'],10)291 self.driver.element_click(self.PSPH_eleloc['element_ph_dj'])292 self.driver.wait_for_one_of_eles(self.PSPH_eleloc['elements_ph_list'],0,10)293 self.driver.one_of_elements_click(self.PSPH_eleloc['elements_ph_list'],0)294 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_wj_card'],10)295 time.sleep(8)296 self.log.info('[action]进入排行榜玩家信息界面成功')297 self.log.info('[action]即将返回发现模块')298 #返回发现模块299 self.driver.element_click(self.PSPH_eleloc['element_ph_wj_goback'])300 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_title'],10)301 self.driver.element_click(self.PSPH_eleloc['element_ph_goback'])302 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'],10)303 self.log.info('[action]返回发现模块成功')304 self.log.info('[action_result]发现模块PS排行榜等级分类查看玩家信息流程操作执行成功')305 self.log.info('[action_end]发现模块PS排行榜等级分类查看玩家信息流程操作执行结束')306 self.log.info('---------------------------------------------------------')307 except Exception as e:308 self.log.error('[action_error]发现模块PS排行榜等级分类查看玩家信息流程操作执行失败.')309 self.log.error('[action_error]错误原因为{}'.format(e))310 self.driver.get_screenshot_image('发现模块PS排行榜等级分类查看玩家信息')311 self.log.info('[get_image]失败场景已截图,请于{}进行查看'.format(image_path))312 self.log.info('---------------------------------------------------------')313 raise314 def action_psph_jbs(self):315 '''发现模块-PS排行榜-通过奖杯数查看玩家信息'''316 self.log.info('[action_start]发现模块PS排行榜奖杯数分类查看玩家信息流程操作执行开始')317 try:318 # 进入发现模块319 self.driver.wait_for_element(self.FX_eleloc['element_fx'], 10)320 self.driver.element_click(self.FX_eleloc['element_fx'])321 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'], 10)322 self.log.info('[action]发现模块进入成功')323 # 进入ps排行榜324 self.driver.wait_for_element(self.FX_eleloc['element_fx_ph'], 10)325 self.driver.element_click(self.FX_eleloc['element_fx_ph'])326 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_title'], 10)327 self.log.info('[action]PS排行榜模块进入成功')328 #进入奖杯数-玩家信息界面329 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_jbs'],10)330 self.driver.element_click(self.PSPH_eleloc['element_ph_jbs'])331 self.driver.wait_for_one_of_eles(self.PSPH_eleloc['elements_ph_list'],0,10)332 self.driver.one_of_elements_click(self.PSPH_eleloc['elements_ph_list'],0)333 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_wj_card'],10)334 time.sleep(8)335 self.log.info('[action]进入排行榜玩家信息界面成功')336 self.log.info('[action]即将返回发现模块')337 #返回发现模块338 self.driver.element_click(self.PSPH_eleloc['element_ph_wj_goback'])339 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_title'],10)340 self.driver.element_click(self.PSPH_eleloc['element_ph_goback'])341 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'],10)342 self.log.info('[action]返回发现模块成功')343 self.log.info('[action_result]发现模块PS排行榜奖杯数分类查看玩家信息流程操作执行成功')344 self.log.info('[action_end]发现模块PS排行榜奖杯数分类查看玩家信息流程操作执行结束')345 self.log.info('---------------------------------------------------------')346 except Exception as e:347 self.log.error('[action_error]发现模块PS排行榜奖杯数分类查看玩家信息流程操作执行失败.')348 self.log.error('[action_error]错误原因为{}'.format(e))349 self.driver.get_screenshot_image('发现模块PS排行榜奖杯数分类查看玩家信息')350 self.log.info('[get_image]失败场景已截图,请于{}进行查看'.format(image_path))351 self.log.info('---------------------------------------------------------')352 raise353 def action_psph_yxs(self):354 '''发现模块-PS排行榜-通过游戏数查看玩家信息'''355 self.log.info('[action_start]发现模块PS排行榜游戏数分类查看玩家信息流程操作执行开始')356 try:357 # 进入发现模块358 self.driver.wait_for_element(self.FX_eleloc['element_fx'], 10)359 self.driver.element_click(self.FX_eleloc['element_fx'])360 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'], 10)361 self.log.info('[action]发现模块进入成功')362 # 进入ps排行榜363 self.driver.wait_for_element(self.FX_eleloc['element_fx_ph'], 10)364 self.driver.element_click(self.FX_eleloc['element_fx_ph'])365 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_title'], 10)366 self.log.info('[action]PS排行榜模块进入成功')367 #进入游戏数-玩家信息界面368 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_yxs'],10)369 self.driver.element_click(self.PSPH_eleloc['element_ph_yxs'])370 self.driver.wait_for_one_of_eles(self.PSPH_eleloc['elements_ph_list'],0,10)371 self.driver.one_of_elements_click(self.PSPH_eleloc['elements_ph_list'],0)372 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_wj_card'],10)373 time.sleep(8)374 self.log.info('[action]进入排行榜玩家信息界面成功')375 self.log.info('[action]即将返回发现模块')376 #返回发现模块377 self.driver.element_click(self.PSPH_eleloc['element_ph_wj_goback'])378 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_title'],10)379 self.driver.element_click(self.PSPH_eleloc['element_ph_goback'])380 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'],10)381 self.log.info('[action]返回发现模块成功')382 self.log.info('[action_result]发现模块PS排行榜游戏数分类查看玩家信息流程操作执行成功')383 self.log.info('[action_end]发现模块PS排行榜游戏数分类查看玩家信息流程操作执行结束')384 self.log.info('---------------------------------------------------------')385 except Exception as e:386 self.log.error('[action_error]发现模块PS排行榜游戏数分类查看玩家信息流程操作执行失败.')387 self.log.error('[action_error]错误原因为{}'.format(e))388 self.driver.get_screenshot_image('发现模块PS排行榜游戏数分类查看玩家信息')389 self.log.info('[get_image]失败场景已截图,请于{}进行查看'.format(image_path))390 self.log.info('---------------------------------------------------------')391 raise392 def action_psph_wms(self):393 '''发现模块-PS排行榜-通过完美数查看玩家信息'''394 self.log.info('[action_start]发现模块PS排行榜完美数分类查看玩家信息流程操作执行开始')395 try:396 # 进入发现模块397 self.driver.wait_for_element(self.FX_eleloc['element_fx'], 10)398 self.driver.element_click(self.FX_eleloc['element_fx'])399 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'], 10)400 self.log.info('[action]发现模块进入成功')401 # 进入ps排行榜402 self.driver.wait_for_element(self.FX_eleloc['element_fx_ph'], 10)403 self.driver.element_click(self.FX_eleloc['element_fx_ph'])404 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_title'], 10)405 self.log.info('[action]PS排行榜模块进入成功')406 #进入完美数-玩家信息界面407 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_wms'],10)408 self.driver.element_click(self.PSPH_eleloc['element_ph_wms'])409 self.driver.wait_for_one_of_eles(self.PSPH_eleloc['elements_ph_list'],0,10)410 self.driver.one_of_elements_click(self.PSPH_eleloc['elements_ph_list'],0)411 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_wj_card'],10)412 time.sleep(8)413 self.log.info('[action]进入排行榜玩家信息界面成功')414 self.log.info('[action]即将返回发现模块')415 #返回发现模块416 self.driver.element_click(self.PSPH_eleloc['element_ph_wj_goback'])417 self.driver.wait_for_element(self.PSPH_eleloc['element_ph_title'],10)418 self.driver.element_click(self.PSPH_eleloc['element_ph_goback'])419 self.driver.wait_for_element(self.FX_eleloc['element_fx_title'],10)420 self.log.info('[action]返回发现模块成功')421 self.log.info('[action_result]发现模块PS排行榜完美数分类查看玩家信息流程操作执行成功')422 self.log.info('[action_end]发现模块PS排行榜完美数分类查看玩家信息流程操作执行结束')423 self.log.info('---------------------------------------------------------')424 except Exception as e:425 self.log.error('[action_error]发现模块PS排行榜完美数分类查看玩家信息流程操作执行失败.')426 self.log.error('[action_error]错误原因为{}'.format(e))427 self.driver.get_screenshot_image('发现模块PS排行榜完美数分类查看玩家信息')428 self.log.info('[get_image]失败场景已截图,请于{}进行查看'.format(image_path))429 self.log.info('---------------------------------------------------------')430 raise431 def quitDriver(self):432 self.driver.quitDriver()...

Full Screen

Full Screen

test001_global_catalog_page.py

Source:test001_global_catalog_page.py Github

copy

Full Screen

...21 lowvoltage = "//h4[contains(text(),'Low voltage')]"22 project = "//*[@id='root']/div[1]/div[3]/div/div[2]/div[2]/div/div/div[1]/div/a/div/div"23 def filterLabel(self):24 actual = 'Filters'25 self.element_click(self.Catlog)26 filter_label = self.get_text(self.filter)27 self.verify_text_contains(actual_text=filter_label, expected_text=actual)28 def collectionFilter(self):29 actual = 'Collection'30 self.element_click(self.Catlog)31 label = self.get_text(self.collection)32 self.verify_text_contains(actual_text=label, expected_text=actual)33 def WarehouseFiler(self):34 actual = 'Warehouse'35 self.element_click(self.Catlog)36 label = self.get_text(self.warehouse)37 self.verify_text_contains(actual_text=label, expected_text=actual)38 def CountryFilter(self):39 actual = 'Country'40 self.element_click(self.Catlog)41 label = self.get_text(self.Country)42 self.verify_text_contains(actual_text=label, expected_text=actual)43 def typeFilter(self):44 actual = 'Type'45 self.element_click(self.Catlog)46 label = self.get_text(self.type)47 self.verify_text_contains(actual_text=label, expected_text=actual)48 def subTypeFilter(self):49 actual = 'Sub type'50 self.element_click(self.Catlog)51 label = self.get_text(self.Subtype)52 self.verify_text_contains(actual_text=label, expected_text=actual)53 def manufactureFilter(self):54 actual = 'Manufacturer'55 self.element_click(self.Catlog)56 label = self.get_text(self.manufacturer)57 self.verify_text_contains(actual_text=label, expected_text=actual)58 def vendorFilter(self):59 actual = 'Vendor'60 self.element_click(self.Catlog)61 label = self.get_text(self.vendor)62 self.verify_text_contains(actual_text=label, expected_text=actual)63 def materialFilter(self):64 actual = 'Material type'65 self.element_click(self.Catlog)66 label = self.get_text(self.materialtype)67 self.verify_text_contains(actual_text=label, expected_text=actual)68 def colorfamilyFilter(self):69 actual = 'Color family'70 self.element_click(self.Catlog)71 label = self.get_text(self.Colorfamily)72 self.verify_text_contains(actual_text=label, expected_text=actual)73 def lightingtagFilter(self):74 actual = 'Lighting tag'75 self.element_click(self.Catlog)76 label = self.get_text(self.lightingtag)77 self.verify_text_contains(actual_text=label, expected_text=actual)78 def lowvoltageFilter(self):79 actual = 'Low voltage'80 self.element_click(self.Catlog)81 label = self.get_text(self.lowvoltage)82 self.verify_text_contains(actual_text=label, expected_text=actual)83 Collection_position = "//h4[contains(text(),'Collection')]"84 see_more = "//div[1]//span[contains(text(),'See more')]"85 #old = "//div[4]//ul[1]//li[7]//span[1]"86 see_less = "//span[contains(text(),'See Less')]"87 def checkSeeMorelink(self):88 time.sleep(4)89 self.element_click(self.Catlog)90 # if self.is_element_present(self.Country_position) == True:91 self.element_click(self.see_more)92 time.sleep(2)93 see_less = self.get_text(self.see_less)94 text = "See Less"95 self.verify_text_contains(actual_text=see_less, expected_text=text)96 time.sleep(2)97 self.element_click(self.see_less)98 time.sleep(2)99 see_more = self.get_text(self.see_more)100 text = "See more"101 self.verify_text_contains(actual_text=see_more, expected_text=text)102 _filter_click = "//label[contains(.,'Bulk 1.0')]"103 _clear_filter = "//p[contains(text(),'Reset filters')]"104 def applyFilter(self):105 time.sleep(2)106 self.element_click(self.Catlog)107 self.web_scroll(direction="up")108 self.wait_for_element(self._filter_click)109 self.element_click(self._filter_click)110 time.sleep(2)111 self.wait_for_element(self._clear_filter)112 clear_filter = self.get_text(self._clear_filter)113 self.verify_text_contains(actual_text=clear_filter, expected_text='Reset filters')114 time.sleep(2)115 # Check filter values after applying the filters.116 # Applied filter on listing screen117 _type_select = "//*[@id='main-container']/main/div/div/div/div[1]/div/div[5]/ul/li[1]/label/div[2]/div/span[1]"118 _sub_type_click = "//*[@id='main-container']/main/div/div/div/div[1]/div/div[6]/ul/li[1]/label/div[2]/div/span[1]"119 _manufacture_click = "//*[@id='main-container']/main/div/div/div/div[1]/div/div[8]/ul/li[1]/label/div[2]/div/span[1]"120 # detail page filter value verification121 _manufacture_value = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[6]/div[2]/div/div/div/div[2]/span[2]"122 _type_value = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[6]/div[2]/div/div/div/div[7]/span[2]"123 _subtype_value = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[6]/div[2]/div/div/div/div[8]/span[2]"124 # click on first cell after applying the filter125 _first_cell = "//*[@id='main-container']/main/div/div/div/div[2]/div/div[2]/a[1]"126 def verifyAppliedFilterDetailPage(self):127 """ verify result after click on manufacturer , type and subtype"""128 time.sleep(2)129 self.element_click(self.Catlog)130 collection = self.get_text(self._filter_click)131 self.element_click(self._type_select)132 time.sleep(2)133 typefilter = self.get_text(self._type_select)134 time.sleep(3)135 self.element_click(self._sub_type_click)136 sub_type = self.get_text(self._sub_type_click)137 time.sleep(3)138 self.element_click(self._manufacture_click)139 manufacture = self.get_text(self._manufacture_click)140 time.sleep(3)141 self.element_click(self._first_cell)142 time.sleep(3)143 subtype_detail_value = self.get_text(self._subtype_value)144 type_detail_value = self.get_text(self._type_value)145 manufacture_detail_value = self.get_text(self._manufacture_value)146 self.verify_text_contains(actual_text=typefilter, expected_text=type_detail_value)147 self.verify_text_contains(actual_text=sub_type, expected_text=subtype_detail_value)148 self.verify_text_contains(actual_text=manufacture, expected_text=manufacture_detail_value)149 print("typefilter->",type_detail_value, "|| sub_type filter->",subtype_detail_value,"||manufacture",manufacture_detail_value)150 self.element_click(self.project)151 time.sleep(2)152 # Locator for search product form global catalog153 _search_box = "//input[@placeholder='Filter by product name, SKU']"154 _product_name = "//*[@id='main-container']/main/div/div/div/div[2]/div/div[2]/a[1]/div[2]/span[1]"155 """search product via search box"""156 def searchBox(self):157 time.sleep(5)158 self.element_click(self.Catlog)159 time.sleep(3)160 product_name = self.get_text(self._product_name)161 time.sleep(2)162 self.element_click(self._search_box)163 time.sleep(4)164 self.EnterProductName(str(product_name))165 time.sleep(2)166 self.pressEnter(Keys.RETURN)167 time.sleep(2)168 SearchedResult = self.get_text(self._product_name)169 self.verify_text_contains(actual_text=product_name, expected_text=SearchedResult)170 print("actual_text=", product_name, "expected_text=",SearchedResult)171 self.element_click(self.project)172 time.sleep(5)173 '''second_product = self.getText(self._second_product_name)174 time.sleep(2)175 second_product = second_product.split()176 for i in second_product:177 if i == 'Rustic':178 return True179 elif i == 'copper':180 return True181 elif i == 'wallet':182 return True183 else:184 return False'''185 def EnterProductName(self, value):186 time.sleep(2)187 self.clear_field(self._search_box)188 time.sleep(2)189 self.send_keys(value, self._search_box)190 def pressEnter(self, value):191 self.send_keys(value, self._search_box)192 _sku = "//*[@id='main-container']/main/div/div/div/div[2]/div/div[2]/a[1]/div[2]/span[2]"193 _custom_sku = "//p[contains(text(),'+ Custom SKU')]"194 def skuSearch(self):195 """Verify SKU once with exact match is match"""196 time.sleep(2)197 self.element_click(self.Catlog)198 sku_text = self.get_text(self._sku)199 time.sleep(1)200 self.element_click(self._search_box)201 time.sleep(4)202 self.EnterProductName(str(sku_text))203 time.sleep(2)204 self.pressEnter(Keys.RETURN)205 time.sleep(2)206 sku_result = self.get_text(self._sku)207 time.sleep(2)208 self.verify_text_contains(actual_text=sku_text, expected_text=sku_result)209 print("actual_text=", sku_text, "expected_text=",sku_result)210 self.clear_field(self._search_box)211 time.sleep(2)212 self.element_click(self.project)213 time.sleep(5)214 def skuSearchCharTrim(self):215 """Verify SKU once first character is trim"""216 time.sleep(5)217 self.element_click(self.Catlog)218 sku_text = self.get_text(self._sku)219 sku_textFC = sku_text[1:]220 self.EnterProductName(sku_textFC)221 time.sleep(5)222 self.pressEnter(Keys.ENTER)223 time.sleep(5)224 sku_result1 = self.get_text(self._sku)225 self.verify_text_contains(actual_text=sku_result1, expected_text=sku_text)226 print("First character trim - ", sku_textFC, "Actual result-", sku_result1, "Expected text-",sku_text)227 self.clear_field(self._search_box)228 self.element_click(self.project)229 time.sleep(5)230 def skuSearch_LowerChar(self):231 """Verify SKU with lower text"""232 time.sleep(5)233 self.element_click(self.Catlog)234 sku_result2 = self.get_text(self._sku)235 sku_textlower = sku_result2.lower()236 self.EnterProductName(sku_textlower)237 time.sleep(5)238 self.pressEnter(Keys.ENTER)239 time.sleep(5)240 sku_result1 = self.get_text(self._sku)241 self.verify_text_contains(actual_text=sku_textlower, expected_text=sku_result1)242 print("actual_text=",sku_textlower, "expected_text=",sku_result1)243 self.clear_field(self._search_box)244 self.element_click(self.project)245 time.sleep(5)246 def skuSearch_FirstLastChTrim(self):247 """Verify SKU with frist and last character trim"""248 time.sleep(5)249 self.element_click(self.Catlog)250 removed_Actual_sku = self.get_text(self._sku)251 removed_FirstCharcterTrim_sku = removed_Actual_sku[1:]252 removed_LastCharcterTrim_sku = removed_FirstCharcterTrim_sku[:-1]253 time.sleep(5)254 self.EnterProductName(removed_LastCharcterTrim_sku)255 time.sleep(5)256 self.pressEnter(Keys.ENTER)257 time.sleep(5)258 sku_result3 = self.get_text(self._sku)259 self.verify_text_contains(actual_text=sku_result3, expected_text=removed_Actual_sku)260 print("Actual result -", sku_result3 , "Expected result-", removed_Actual_sku)261 self.clear_field(self._search_box)262 time.sleep(2)263 self.element_click(self.project)264 time.sleep(5)265 _click_most_relevant_dropdown = "//div[@id='root']//div[contains(text(),'Most relevant')]"266 _click_sort_by_lowest = "//div[@id='root']//div[contains(text(),'Sort by lowest price')]"267 _click_sort_by_highest = "//div[@id='root']//div[contains(text(),'Sort by highest price')]"268 _click_sort_by_rating = "//div[@id='root']//div[contains(text(),'Sort by highest rating')]"269 _click_sort_by_most_reviewed = "//div[@id='root']//div[contains(text(),'Sort by most reviewed')]"270 def pressDownKey(self, value):271 self.send_keys(value, self._click_most_relevant_dropdown)272 def pressEnterSortSelection(self, value):273 self.send_keys(value, self._click_most_relevant_dropdown)274 def clickSortLowestDropdown(self):275 time.sleep(4)276 self.element_click(self.Catlog)277 time.sleep(2)278 self.element_click(self._click_most_relevant_dropdown)279 time.sleep(5)280 a = self.element_click(self._click_sort_by_lowest)281 self.log.info(a)282 time.sleep(4)283 self.log.info("hi this is a print")284 a = "//body/div[@id='root']//div"285 c = '/div[1]/div[2]/div[1]//span[1]'286 list = []287 for i in range(2, 25):288 x = [i]289 price_xpath = a + str(x) + c290 time.sleep(4)291 if self.is_element_present(price_xpath) == False:292 break293 else:294 price = self.get_text(price_xpath)295 price = price.replace("$", '')296 price = price.replace(",", '')297 (list.append(float(price)))298 self.log.info("Original list : " + str(list))299 # using all() to300 # check sorted list301 flag = 0302 if (list == sorted(list)):303 flag = 1304 # printing result305 if (flag):306 self.log.info("Yes, List is sorted.")307 return True308 else:309 self.log.info("No, List is not sorted.")310 return False311 GC_link = "//*[@id='main-container']/main/div/div/div[1]/span[1]"312 Rating = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[1]/div[1]/p[1]"313 def sortRating(self):314 """test_14Verify_Sort_By__Highest_Rating"""315 time.sleep(4)316 self.element_click(self.Catlog)317 time.sleep(2)318 self.element_click(self._click_most_relevant_dropdown)319 time.sleep(5)320 self.element_click(self._click_sort_by_rating)321 time.sleep(5)322 card1 = "//*[@id='main-container']/main/div/div/div/div[2]/div/div[2]/a["323 card2 = "]/div[1]"324 list = []325 for i in range(2, 25):326 _path = card1 + str(i) + card2327 self.element_click(_path)328 time.sleep(5)329 RatingValue = self.get_text(self.Rating)330 #RatingValue = RatingValue.replace("0", '')331 #RatingValue = RatingValue.replace(".", '')332 list.append(float(RatingValue))333 self.element_click(self.GC_link)334 ExpResult = "True"335 if(list == sorted(list,reverse=True)):336 ActResult = "True"337 print("list is sorted",list)338 else:339 ActResult = "False"340 print("list is not sorted",list)341 self.verify_text_match(ActResult,ExpResult)342 # Qtywarehouse locators for xpath343 QtyWarehouse = "//h4[contains(text(),'Qty in warehouse')]"344 QtywarehouseValue = "//*[@id='main-container']/main/div/div/div/div[1]/div/div[3]/ul/ul/div/div[1]/div/div/input"345 warehouseCheckbox_xpath = "//*[@id='main-container']/main/div/div/div/div[1]/div/div[3]/ul/li[1]/label/div[2]/div/span[1]"346 Applybutton_qty ="//*[@id='main-container']/main/div/div/div/div[1]/div/div[3]/ul/ul/div/button/span"347 QtyResult_card = "//*[@id='main-container']/main/div/div/div/div[2]/div/div[2]/a[1]"348 Availibility = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[4]/div[1]/span[1]"349 warehousenameExpted = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[4]/div[2]/div/div/div/div[2]/div[2]/table/tbody/tr/td[1]/div/div/div/div/strong"350 QtyActualvaluepath = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[4]/div[2]/div/div/div/div[2]/div[2]/table/tbody/tr/td[2]/div/div/div"351 def QtyWarehouse(self):352 time.sleep(2)353 self.element_click(self.Catlog)354 time.sleep(2)355 expvalueWarehouse=self.get_text(self.warehouseCheckbox_xpath)356 self.element_click(self.warehouseCheckbox_xpath)357 time.sleep(2)358 self.element_click(self.QtywarehouseValue)359 time.sleep(2)360 self.clear_field(self.QtywarehouseValue)361 time.sleep(2)362 self.send_keys(50, self.QtywarehouseValue)363 time.sleep(2)364 self.element_click(self.Applybutton_qty)365 time.sleep(2)366 self.element_click(self.QtyResult_card)367 time.sleep(2)368 self.element_click(self.Availibility)369 time.sleep(2)370 QtyinwarehouseActualvalue=self.get_text(self.QtyActualvaluepath)371 warehouseActualValue = self.get_text(self.warehousenameExpted)372 if(int(QtyinwarehouseActualvalue)<50):373 print("condition does not match")374 else:375 self.verify_text_contains(actual_text=warehouseActualValue, expected_text=expvalueWarehouse)376 print("actual_text=", warehouseActualValue, "expected_text=",expvalueWarehouse)377 self.element_click(self.project)378 time.sleep(5)379 #loctaor for country availability380 Countrychebox = "//*[@id='main-container']/main/div/div/div/div[1]/div/div[4]/ul/li[1]/label"381 Country_Availabitly_actual = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[4]/div[2]/div/div/div/div[3]/strong"382 #Country_avl_label = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[4]/div[2]/div/div/div/strong[2]"383 def Country_availability(self):384 """Verify Quantity in warehouse"""385 time.sleep(2)386 self.element_click(self.Catlog)387 time.sleep(4)388 self.element_click(self.Countrychebox)389 CA_Expected = self.get_text(self.Countrychebox)390 CA_Expected = CA_Expected[:-5]391 time.sleep(4)392 self.element_click(self.QtyResult_card)393 time.sleep(5)394 self.element_click(self.Availibility)395 time.sleep(5)396 #CAL=self.get_text(self.Country_avl_label)397 CA_Actual=self.get_text(self.Country_Availabitly_actual)398 CA_Actual= CA_Actual.strip()399 #if self.is_element_present(CAL) == False:400 #print("Country does not exit")401 #else:402 self.verify_text_contains(actual_text=CA_Actual.strip(),expected_text=CA_Expected.strip())403 print("Country availabilty excepted value ->",CA_Expected, "||Country availabilty excepted value ->", CA_Actual)404 self.element_click(self.project)405 time.sleep(5)406 #locator for lighting tag407 ligtingCheckbox = "//*[@id='main-container']/main/div/div/div/div[1]/div/div[11]/ul/li[1]/label"408 product_card_result = "//*[@id='main-container']/main/div/div/div/div[2]/div/div[2]/a[1]"409 Ligting_information_pdp = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[6]/div[2]/div/div/div[2]/div/div[1]/span[1]"410 lighting_fixer = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[6]/div[2]/div/div/div[2]/div/div[2]/div/div/div/div[1]/span[2]"411 def Lighting_Tag(self):412 """Verify Lighting Tags in PDP"""413 time.sleep(5)414 self.element_click(self.Catlog)415 time.sleep(4)416 self.element_click(self.ligtingCheckbox)417 time.sleep(4)418 ExpValue_Lighting_Tag = self.get_text(self.ligtingCheckbox)419 ExpValue_Lighting_Tag = ExpValue_Lighting_Tag[:4]420 self.element_click(self.product_card_result)421 time.sleep(5)422 LightingTag_label = self.get_text(self.Ligting_information_pdp)423 Actual_value_lightingTag = self.get_text(self.lighting_fixer)424 if LightingTag_label in ("Lighting information"):425 self.verify_text_contains(actual_text=Actual_value_lightingTag.strip(),expected_text=ExpValue_Lighting_Tag.strip())426 print("actvalue =", Actual_value_lightingTag, "ExpValue =", ExpValue_Lighting_Tag)427 else:428 print("Lighting information label does not found")429 print(LightingTag_label)430 self.element_click(self.project)431 time.sleep(5)432 # Verify tag selected from left side should show expected list accordingly.433 _bulk_tag = "//*[@id='main-container']/main/div/div/div/div[2]/div/div[2]/a[1]/div[2]/div/div/div[1]"434 collection_see_more = "//div[@id='root']/div/div[3]/div/div/div[2]/div/div/div[3]/ul/li[7]/span"435 _bulk_2 = "//label[contains(.,'Bulk 2.0')]"436 def filterTagBulk2(self):437 time.sleep(5)438 self.element_click(self.Catlog)439 time.sleep(4)440 self.element_click(self._bulk_2)441 name = self.get_text(self._bulk_2)442 name = name[:-4]443 time.sleep(2)444 bulk_tag_text = self.get_text(self._bulk_tag)445 time.sleep(2)446 self.verify_text_contains(actual_text=bulk_tag_text.strip(), expected_text=name.strip())447 print("actual_text",bulk_tag_text, "expected_text",name)448 self.element_click(self.project)449 time.sleep(5)450 self.element_click(self.project)451 time.sleep(5)452 _custom_tag = "//label[contains(.,'Custom')]"453 def filterTagCustom(self):454 time.sleep(5)455 self.element_click(self.Catlog)456 time.sleep(4)457 self.element_click(self._custom_tag)458 name = self.get_text(self._custom_tag)459 name = name[:-5]460 time.sleep(2)461 bulk_tag_text = self.get_text(self._bulk_tag)462 bulk_tag_text1 = bulk_tag_text.lower()463 time.sleep(2)464 self.verify_text_contains(actual_text=bulk_tag_text1.strip(),expected_text=name.strip())465 print("actual_text",bulk_tag_text, "expected_text=",name)466 self.element_click(self.project)467 time.sleep(5)468 _NorthAmerica2020_tag = "//label[contains(.,'NorthAmerica2020')]"469 _pdp_tag = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[1]/div[2]/div"470 def filterTagNorthAmerica2020(self):471 time.sleep(5)472 self.element_click(self.Catlog)473 time.sleep(4)474 self.element_click(self.see_more)475 time.sleep(2)476 self.element_click(self._NorthAmerica2020_tag)477 name = self.get_text(self._NorthAmerica2020_tag)478 name = name[:-5]479 time.sleep(2)480 self.element_click(self._first_cell)481 _pdp_tag_text = self.get_text(self._pdp_tag)482 PD_Tag1 = _pdp_tag_text.lower()483 time.sleep(2)484 self.verify_text_contains(actual_text=PD_Tag1.strip(), expected_text=name.strip())485 print("actual_text", PD_Tag1, "expected_text=", name)486 self.element_click(self.project)487 time.sleep(5)488 _phoenix_tag = "//label[contains(.,'Phoenix')]"489 def filterTagPhoenix(self):490 time.sleep(5)491 self.element_click(self.Catlog)492 time.sleep(4)493 self.element_click(self.see_more)494 time.sleep(2)495 self.element_click(self._phoenix_tag)496 name = self.get_text(self._phoenix_tag)497 name = name[:-5]498 time.sleep(2)499 bulk_tag1= self.get_text(self._bulk_tag)500 bulk_tag2 = bulk_tag1.lower()501 time.sleep(2)502 self.verify_text_contains(actual_text=bulk_tag2.strip(), expected_text=name.strip())503 print("Actual_text=",bulk_tag2 ,"expected_text=",name)504 self.element_click(self.project)505 time.sleep(5)506 PD = "//*[@id='main-container']/main/div/div/div[1]/span[1]"507 def sortmostreviewed(self):508 """test_15_Verify_Sort_By__Most_Reviewed"""509 time.sleep(4)510 self.element_click(self.Catlog)511 time.sleep(2)512 self.element_click(self._click_most_relevant_dropdown)513 time.sleep(5)514 self.element_click(self._click_sort_by_most_reviewed)515 time.sleep(5)516 time.sleep(5)517 card1 = "//*[@id='main-container']/main/div/div/div/div[2]/div/div[2]/a["518 card2 = "]/div[1]"519 list = []520 for i in range(2, 25):521 _path = card1 + str(i) + card2522 self.element_click(_path)523 time.sleep(5)524 review = "//*[@id='main-container']/main/div/div/div[2]/div[3]/div[2]/div[1]/div[1]/p[2]"525 ReviewsValue = self.get_text(review)526 ReviewsValue = ReviewsValue.replace("See", '')527 ReviewsValue = ReviewsValue.replace("reviews", '')528 ReviewsValue = ReviewsValue.replace("one review", '')529 #print(ReviewsValue)530 self.element_click(self.PD)531 list.append(float(ReviewsValue))532 self.log.info(list)533 flag = 0534 if (list == sorted(list, reverse=True)):535 self.log.info("Yes, List is sorted.")536 else:537 self.log.info("No, List is not sorted.")538 self.element_click(self.project)539 #PD = "//*[@id='main-container']/main/div/div/div[1]/span[1]"540 def sorthighest1(self):541 """test_13_Verify_Sort_By__Highest_price"""542 time.sleep(4)543 self.element_click(self.Catlog)544 time.sleep(2)545 self.element_click(self._click_most_relevant_dropdown)546 time.sleep(5)547 a = self.element_click(self._click_sort_by_highest)548 time.sleep(3)549 card1 = "//*[@id='main-container']/main/div/div/div/div[2]/div/div[2]/a["550 card2 = "]/div[2]/div/span"551 list = []552 for i in range(2, 25):553 _path = card1 + str(i) + card2554 pricevalue = self.get_text(_path)555 time.sleep(5)556 pricevalue = pricevalue.replace("$", '')557 pricevalue = pricevalue.replace(",", '')558 list.append(float(pricevalue))559 ExpResult = "True"560 if (list == sorted(list, reverse=False)):561 flag = "True"562 print("Yes, List is sorted.")563 else:564 flag = "False"565 print("No, List is not sorted.")566 self.verify_text_contains(ExpResult,flag)...

Full Screen

Full Screen

homePage.py

Source:homePage.py Github

copy

Full Screen

1import logging2from utilities import base_utils as bu3from selenium.webdriver.common.by import By4class HomePage:5 log = bu.customLogger(logging.DEBUG)6 def __init__(self, driver):7 self.driver = driver8 '''9 will not use 'find_element_by_id' type for use function10 '''11 # self.login_user_id = "menuUserLink"12 self.loginimage = (By.ID, "menuUserLink")13 self.input_user = (By.NAME, "username") #userID box14 self.input_password = (By.NAME, "password")15 self.button_signin = (By.ID, "sign_in_btnundefined")16 self.userID_span = (By.XPATH, "//a[@id='menuUserLink']/span") #after log in, can see userID17 self.signout_lable = (By.XPATH, "//div[@id='loginMiniTitle']/label[3]")18 self.tablet_label = (By.ID, "tabletsLink")19 def verify_homepage(self):20 bu.is_enabled(self.driver, 10, self.loginimage)21 def open_login_window(self):22 bu.element_Click(self.driver, 10, self.loginimage)23 def enter_username(self, username):24 bu.clear_text(self.driver, 10, self.input_user)25 bu.enter_text(self.driver, 10, self.input_user, username)26 # self.driver.find_element_by_name(self.input_user_name).clear()27 # self.driver.find_element_by_name(self.input_user_name).send_keys(username)28 def enter_password(self, password):29 bu.clear_text(self.driver, 10, self.input_password)30 bu.enter_text(self.driver, 10, self.input_password,password)31 def click_signin(self):32 bu.element_Click(self.driver, 10, self.button_signin)33 def verify_userID(self, username):34 bu.assert_element_text(self.driver, 10, self.userID_span, username)35 def click_userID(self):36 bu.element_Click(self.driver, 10, self.userID_span)37 def click_signout(self):38 bu.element_Click(self.driver, 10, self.signout_lable)39 def click_tablet(self):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run AutoItDriverServer automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful