本文整理汇总了Python中selenium.webdriver.support.ui.Select.replace方法的典型用法代码示例。如果您正苦于以下问题:Python Select.replace方法的具体用法?Python Select.replace怎么用?Python Select.replace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类selenium.webdriver.support.ui.Select
的用法示例。
在下文中一共展示了Select.replace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QueryData
# 需要导入模块: from selenium.webdriver.support.ui import Select [as 别名]
# 或者: from selenium.webdriver.support.ui.Select import replace [as 别名]
def QueryData(self,el,msgmode=None,data=None,link=None,submode=None,button=None,Inquiry=None):
"""
查看数据的正确性
:param self:
:param el:
:param msgmode:xml文件中元素定位名称
:param data:输入的数据
:param link:环节
:param submode:单套询价的询价类型
:param button:数据详细界面的按钮
:param Inquiry:询价类型,如多套,单套
:return:
"""
if Inquiry==None:
commond.Duantao(self,el,submode)
listid=QueryClickLinkData(el,msgmode,link,functionName='Querylist')
#listid=commond.ClickLinkData(el,msgmode,link,functionName='Querylist')
#commond.Switchto_Frame(self,Inquiry)
currentuser=commond.sessionName
valuer=commond.Valuer
'''
self.driver.switch_to.default_content()
el.getFunctionName(MsgFrm[0])
el.get_element(MsgFrm[1])
xf = el.get()
self.driver.switch_to.frame(xf)
time.sleep(5)
'''
commond.switchToDetailUI(self,el)
if button==1:
el.getFunctionName(ExamineModif[0])
el.get_element('keybutton')
for i in range(len(el.gets())):
keyvalue=el.gets()[i].get_attribute('value')
if msgmode==keyvalue:
return keyvalue
else:
logging.error(u'没有此按钮,请确认!')
exit(u'退出测试')
else:
addnew.checkTab(el)
el.getFunctionName(ExamineModif[0])
el.get_element(msgmode)
dictFunction = EL.get_el_dict(ExamineModif[0], msgmode, xmlpath)
try:
tagname = el.get().get_attribute('tagname')
except:
tagname='Element not exist'
if tagname == None:
tagname = ''
currenttext = u'没有类型'
if tagname!='Element not exist':
if 'elementType' in dictFunction:
if dictFunction['elementType'] == 'select':
if dictFunction['type']=='xpath':
ellen=len(el.gets())
if ellen>1:
currenttext=''
for i in range(ellen):
currenttext+=Select(el.gets()[i]).all_selected_options[0].text
if msgmode=='weituokehu':
currenttext=currenttext[1:]
else:
currenttext=Select(el.gets()[0]).all_selected_options[0].text
else:
currenttext = Select(el.get()).all_selected_options[0].text
elif dictFunction['elementType'] == 'input' or dictFunction['elementType'] == 'textarea':
currenttext = el.get().get_attribute('value').strip()
else:
currenttext = el.get().text.strip()
else:
currenttext =''
logging.info(tagname + u':' + currenttext.rstrip(u'请选择'))
#结果为数字
if currenttext.replace(',','').replace('.','').isdigit():
if currenttext.find(',')>0:
currentvalue=currenttext.replace(',','')
else:
currentvalue=float(currenttext)
if msgmode=='pingguzongjia' or msgmode=='jingzhi':
return round(float(currentvalue)/10000,2)==float(listid)
return float(currentvalue)==float(listid)
if currenttext==''or currenttext=='0' and float(listid)==0:
return True
return (currenttext.rstrip(u'请选择').strip()==listid)
else:
commond.OtherXujia(self,el,Inquiry)