kww
(kww)
2023 年2 月 15 日 07:12
1
问题
form前面还有iframe标签,在谷歌浏览器的console处能定位到更换这个元素,但是代码运行定位不到更换这个元素
<form event-render="loadForm" poin role="form" target="_bank" accept="application/x-www-form-urlencoded" autocomplete="off" class="form-horizontal poin-form" data-loading="false" data-istoken="false" data-sign="false" id="UserForm">
<div class="col tr">
<div class="co14 text_right">预留信息:</div>
<div class="wd280 float left">.</div>
<div style="margin-bottom:0px;"id="layerDemo"class>
<a href="#" onclick="replace2()" style="padding: 30px;">更换</a>
</div>
</form>
kww
(kww)
2023 年2 月 15 日 09:42
4
这么个场景:
就是我要修改的页面在iframe窗口中,修改成功后,会有弹窗提示,“修改成功”,这个弹窗不在iframe窗口中。但是吧,关闭这个提示信息,还停留在这个要修改的页面,这个修改的页面也还是在iframe中,,,断言的话,我准备加两个,第一个是断言修改成功后,是否有修改成功的提示信息,,第二个断言是修改成功后,修改后的数据是否正确
现在不知道关于修改成功提示信息的代码怎么写?,还有两个断言应该怎么写?
class personINfoPage(basePage):
_yuliu=(By.ID, 'yuliu')
def personinfo.reserveinfo succ(self, yuliu):
# 点击用户中心
self.driver.find.element(By.XPATH,'//*[@id="menu_10000"]/a').click()
# 点击个人信息
self.driver.find_element(By.ID,'menu_10002').click()
# 切换iframe窗口
self.driver.switch_to.frame("_menu_10002iframeMain")
# 点击更换按钮
self.driver.find_element(By.XPATH,'//*[@id="UserForm"]/div[4]/div[3]/a').click()
# 先清空预留信息旧数据,再输入新数据
clear_yuliuxinxi = self.find(*self._yuliu)
clear_yuliuxinxi.clear()
clear_yuliuxinxi.send_keys(yuliu)
self.driver.find_element(B.XPATH, '//*[@id="yuliuxinxi"]/div/div/div[2]/div/button[1]').click()
class test_personinfo():
def test personinfo_reserveInfo_succ(self):
# 更换预留信息
result=self.main.gotoyonghuzhongxin().goto_personan InfoPage().personInfo_reserveInfo_succ("123456"D
print(result)
# assert "123456" == result