对于我的生活,我无法控制这种模式中的任何东西。我只想点击这个dang保存按钮。
对于所有其他类似的模态,我能够成功使用此代码:
@driver.switch_to.frame @driver.find_element(:xpath, "//*[contains(@name, 'modal')]")
这次我得到了一个未找到的错误。
这里是模式的html我试图访问-NOTE模式编号改变所以我不能硬编码modal3:
并且这里是按钮的html:
<html class=" ext-strict">
<head>
<body class=" ext-gecko ext-gecko2" keydownhandlerset="true">
<div id="patientChartsContainer">
<div id="patientSearch" style="display:none">
<div class="tooltipWrapper">
<div id="patientPhotoContainer"></div>
<div id="modalWindowContainer" class="">
<div class="axShadowLayer window local" style="display: block; width: 558px; height: 453px; left: 384px; right: auto; top: 228px; z-index: 1010;">
<div class="axShadowTopRow">
<div class="axShadowMiddleRow">
<div class="axShadowBottomRow">
<div class="axShadowContentLayer">
<div class="priModalWrapper">
<ul class="priModalHeader">
<div class="priModalContentBackground"></div>
<ul class="priModalFooter">
<div class="priModalContentWrapper">
<div class="priModalContentContainer">
<iframe id="modal1" class="windowFrame" name="modal1" src="/chart/ui/desktop/patientCharts/chartSummary/chartNote/createChartNote/createNoteModal.html" allowtransparency="true" frameborder="0">
<!DOCTYPE html>
<html class=" ext-strict" xmlns="http://www.w3.org/1999/xhtml">
<head>
<body class=" ext-gecko ext-gecko2" keydownhandlerset="true">
<div id="newNoteContainer" class="newEncounterNote">
<ul class="newNoteOptions">
<div class="axModalButtonsFooter">
<div class="footerButtonsWrapperRight">
<div class="buttonClass axSaveButton">
<span>Save</span>
我已尝试过以下内容和变化:
#@driver.find_element(:xpath, "//div[@id='modalWindowContainer']/div/div[4]/div/ul/li/div[2]/div[3]").click
#@driver.switch_to.frame @driver.find_element(:xpath, "//*[contains(@name, 'modal')]")
#@driver.switch_to.default_content
#@driver.switch_to.frame(@driver.find_element(:class, 'windowFrame'))
#@driver.find_element(:css, "div.buttonClass.axSaveButton").click
#@driver.switch_to.frame @driver.find_element(:class, 'windowFrame')
#@driver.find_element(:xpath => "//button/span[contains(text(),'Save')]").click
/ HTML /体/格1 / DIV / DIV / DIV /跨度
答案 0 :(得分:0)
尝试:
[Peoples_Names]
这将:
#@driver.switch_to.default_content
#@driver.switch_to.frame @driver.find_element(:class, 'windowFrame')
#@driver.find_element(:css, "div.buttonClass.axSaveButton > span").click
标记