我正在尝试将图像附加到电子邮件作为普通附件(而非内嵌图像),但在html DOM上,Firebug发现了两个带有xpath
//input@type='file'
的元素,因为我有两个按钮,允许我添加图片:Insert file
和Attach foto
,请参阅随附的屏幕截图。出于某种原因,图像始终作为内联文件添加到邮件正文中。我尝试以不同的方式唯一地标识xpath
按钮的Insert
,但图像始终与文本内联。
有人可以建议解决方案吗?
作为普通附件插入: -
使用文字内嵌添加图片: -
编辑:html
<document>
<html>
<head>
<body class="globalnavigation" data-atip="inbox" data-application="inbox" data-l_iid="11">
<div class="CDB-global-header" role="navigation">
<div id="frameMod" class="globalnavigation" data-mailboxtotalsize="232159303" data-introduction="false" data-loginrequest="true" data-serverhost="cmpweb99" data-l_iid="12">
<div id="headerArea">
<div id="contentArea" class="advert wide">
<div id="frameScaleLeft" class=" wide">
<!-- <div id="tAdConatiner"> -->
<!-- TODO: put T-AD here -->
<!-- </div> -->
<div id="frameScaleRight" class=" wide">
<div id="frameClmRight">
<div id="contentHeader" class="borderBottom">
<div id="toolbar" data-atip="toolbar">
<div id="textLinkContainer" style="display: none;">
<div id="messagelist" class="listContainer isExtendedListView sortingEnabled" aria-label="Nachrichtenliste" title="Nachrichtenliste" data-l_iid="32" style="display: none;">
<div id="messageContainer" class="writeMailContainer" data-stat="" aria-label="E-Mail Schreiben - Ansicht" title="E-Mail Schreiben - Ansicht" data-atip="mailwriteview" data-priority="normal" data-editormode="html" data-msgidheader="" data-continuemsg="" data-forwardsmsgs="" data-inreplytomsgs="" data-folderid="" data-l_iid="341" data-rnd="};&a+?9x~wxa((#}~%xd6'ud#K==}<=|#%+u|?}F%t8l">
<form title="" onsubmit="return false" action="" name="writemail" method="post">
<div id="messageWrapper">
<div class="edge"/>
<script type="text/javascript"> var recipientsToTempArray = []; var recipientsCcTempArray = []; var recipientsBccTempArray = []; </script>
<div id="messageHeaderContainer">
<div id="attachmentContainer" class="empty" data-atip="attachment" data-l_iid="344">
<div id="messageBodyContainer" data-texttype="html" style="height: 385px;">
<div id="textAreaSpacerZone" data-l_mouse_cl="Mailwriteview::setFocusInBodyPart"/>
<div class="textAreaContainer" style="display: block;">
<div class="rte">
<div class="rteWrapper">
<div id="mceu_250" class="mce-tinymce mce-container mce-panel" role="application" tabindex="-1" hidefocus="1" style="visibility: hidden; border-width: 1px;">
<div id="rteToolbar" class="mce-container-body mce-stack-layout">
<div id="mceu_251" class="mce-toolbar-grp mce-container mce-panel mce-stack-layout-item mce-first" role="group" tabindex="-1" hidefocus="1" style="width: 800px;">
<div id="mceu_251-body" class="mce-container-body mce-stack-layout">
<div id="mceu_252" class="mce-container mce-toolbar mce-stack-layout-item mce-first mce-last" role="toolbar">
<div id="mceu_252-body" class="mce-container-body mce-flow-layout">
<div id="mceu_253" class="mce-container mce-flow-layout-item mce-first mce-btn-group" role="group">
<div id="mceu_254" class="mce-container mce-flow-layout-item mce-btn-group" role="group">
<div id="mceu_255" class="mce-container mce-flow-layout-item mce-btn-group" role="group">
<div id="mceu_256" class="mce-container mce-flow-layout-item mce-btn-group" role="group">
<div id="mceu_257" class="mce-container mce-flow-layout-item mce-btn-group" role="group">
<div id="mceu_258" class="mce-container mce-flow-layout-item mce-btn-group" role="group">
<div id="mceu_259" class="mce-container mce-flow-layout-item mce-btn-group" role="group">
<div id="mceu_259-body" style="position: relative;">
<div id="mceu_248" class="mce-widget mce-btn mce-first mce-last" aria-labelledby="mceu_248" tabindex="-1" role="button" aria-label="Bild einfügen/ersetzen" style="z-index: 3;">
<div id="html5_1avbl0qhf1rdv73j1bq61bl1v2183_container" class="moxie-shim moxie-shim-html5 pluploadFix_mceu_248" style="position: absolute; top: 0px; left: 0px; width: 27px; height: 26px; overflow: hidden; z-index: 2;">
<input id="html5_1avbl0qhf1rdv73j1bq61bl1v2183" type="file" accept="" multiple="" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;"/>
</div>
</div>
</div>
<div id="mceu_260" class="mce-container mce-flow-layout-item mce-last mce-btn-group" role="group">
</div>
</div>
</div>
</div>
<div id="mceu_261" class="mce-edit-area mce-container mce-panel mce-stack-layout-item mce-last" role="group" tabindex="-1" hidefocus="1" style="border-width: 1px 0px 0px;">
</div>
</div>
<textarea id="lisaRte" class="mceEditor" style="width: 100%; display: none;" name="elm1" aria-hidden="true"/>
<div class="rteplainwrapper" style="display: none;">
</div>
</div>
</div>
</div>
<textarea id="hideTextArea"/>
</div>
</form>
<dropcontainer id="dropcontainerAttachment" class="writemailDropContainer" data-droptarget="attachment">
<dropcontainer id="dropcontainerInline" class="writemailDropContainer" data-droptarget="inline">
</div>
<script id="scb_tsqxcpgd">var startrnd = function(){var x = $('#scb_tsqxcpgd');x.prev().attr('data-rnd', "};&a+?9x~wxa((#}~%xd6'ud#K==}<=|#%+u|?}F%t8l");};</script>
<script id="scb_wejvnkhf">var startrnd = function(){var x = $('#scb_wejvnkhf');x.prev().attr('data-rnd', "+a'c(sy_\"&'D|s9b'b\"J#'Aq5_Dc\"K=F2=#u4''`(s\"l");};</script>
<script id="scb_czexgqvs">var startrnd = function(){var x = $('#scb_czexgqvs');x.prev().attr('data-rnd', "+=}F'a9+\"&+A~vu&};}w|___6(u}~v`:}<y9}tE=%b&l");};</script>
<script id="scb_hjbdknzd">var startrnd = function(){var x = $('#scb_hjbdknzd');x.prev().attr('data-rnd', "6s&c2?'<2(#=}vgc$a4I4Kqv$v}a%?5(}%yC()ux|(_l");};</script>
<script id="scb_eikiadpj">var startrnd = function(){var x = $('#scb_eikiadpj');x.prev().attr('data-rnd', "~v4J5t5I+`+|'thF5=5H2)+B\"'+x|s#!*K##3;#t\"bxl");};</script>
<script id="scb_lmbatyry">var startrnd = function(){var x = $('#scb_lmbatyry');x.prev().attr('data-rnd', "*>Aw%s9I}(cb+t&`'>xd&_`+'`8J'>#=%%\"`};+:\";&l");};</script>
<script id="scb_iofvihaw">var startrnd = function(){var x = $('#scb_iofvihaw');x.prev().attr('data-rnd', "};&a2t5J2w@I'aca|=#;5;us4u5c*_E}#a`|5t|a*;*l");};</script>
<script id="scb_jzmlnflp">var startrnd = function(){var x = $('#scb_jzmlnflp');x.prev().attr('data-rnd', "'<+@%)*_2;5$$<+?}a<c}(Ab%_u?%>#t|v=_3&5a$v*l");};</script>
<script id="scb_yhhckzdy">var startrnd = function(){var x = $('#scb_yhhckzdy');x.prev().attr('data-rnd', "6'tJ5wy(}&`F#;5z}w9@'uye'`#:}s'B6)4I(v#s~'<l");};</script>
</div>
</div>
<div id="frameScaleRightBorder" class="wide">
<div id="frameScaler"/>
</div>
</div>
<div class="afs_ads" style="display: none;"/>
<a id="typeformHiddenLink" class="typeform-share" target="_blank" data-mode="2" href="https://t-online.typeform.com/"/>
<div id="lisaInfoBlock" style="display:none;">
<iframe id="EmetriqTracking" style="display: none;" src="/ZW1haWxiZXRh/em/html/stats/getrenderedemetriqcontent"/>
<div id="secureInfoFlyout" style="left: 515.483px; top: 267.65px; display: none;">
<div id="mceu_29" class="mce-widget mce-tooltip mce-tooltip-n" role="presentation" style="left: 476.883px; top: 379.633px; z-index: 131070; display: none;">
<div id="exposeMask" class="overlay-mask" style="position: absolute; top: 0px; left: 0px; width: 1696px; height: 734px; display: none; opacity: 0.5; z-index: 11035; background-color: rgb(0, 0, 0);"/>
<div class="menuWrapper medium " data-atip="toolbar::attachment" data-l_iid="359" style="left: 1028.35px; top: 170.117px; display: block;">
<table class="menuTable" tabindex="-1">
<tbody>
<tr id="attachmentFromPc" class="" aria-label="Vom Computer" title="Vom Computer" tabindex="0" data-atip="attachmentFromPc||C|A" data-itemid="attachmentFromPc" data-l_mouse_cl="Menu.Item::click" data-l_iid="356">
<td style="font-weight: normal; position: relative;">
<div class="iconContainer">
<div id="attachmentFromPc_caption" class="caption indented" style="position: relative; z-index: 1;">Vom Computer</div>
<div id="html5_1avbl0r2q1kbfkqv361hdcb788_container" class="moxie-shim moxie-shim-html5 pluploadFix_attachmentFromPc_caption" style="position: absolute; top: 0px; left: 0px; width: 0px; height: 0px; overflow: hidden; z-index: 0;">
<input id="html5_1avbl0r2q1kbfkqv361hdcb788" class="" type="file" accept="" multiple="" style="font-size: 999px; opacity: 0; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;"/>
</div>
</td>
</tr>
<tr id="attachmentFromDlsi" class="" aria-label="Aus MagentaCLOUD" title="Aus MagentaCLOUD" tabindex="0" data-atip="attachmentFromDlsi||C|A" data-itemid="attachmentFromDlsi" data-l_mouse_cl="Menu.Item::click" data-l_iid="357">
<tr id="attachmentFromDropbox" class="" aria-label="Aus Dropbox" title="Aus Dropbox" tabindex="0" data-atip="attachmentFromDropbox||C|A" data-itemid="attachmentFromDropbox" data-l_mouse_cl="Menu.Item::click" data-l_iid="358">
</tbody>
</table>
</div>
</body>
</html>
</document>
答案 0 :(得分:0)
要Insert file
以cssSelector
下面的tr#attachmentFromPc input[type = 'file']
使用唯一标识: -
{
"com.mycompany.content": {
"mappings": {
"pageMasterContent": {
"properties": {
"contentType": {
"type": "string",
"term_vector": "with_positions_offsets",
"include_in_all": true
},
"customer": {
"type": "nested",
"properties": {
"class": {
"type": "string",
"index": "no",
"include_in_all": false
},
"customerName": {
"type": "string",
"term_vector": "with_positions_offsets",
"include_in_all": true
},
"id": {
"type": "long",
"include_in_all": false
},
"ref": {
"type": "string",
"index": "no",
"include_in_all": false
}
}
},
"language": {
"type": "nested",
"properties": {
"class": {
"type": "string",
"index": "no",
"include_in_all": false
},
"id": {
"type": "long",
"include_in_all": false
},
"langName": {
"type": "string",
"term_vector": "with_positions_offsets",
"include_in_all": false
},
"ref": {
"type": "string",
"index": "no",
"include_in_all": false
}
}
},
"pageContent": {
"type": "string",
"term_vector": "with_positions_offsets",
"include_in_all": true
},
"pageMaster": {
"type": "nested",
"properties": {
"class": {
"type": "string",
"index": "no",
"include_in_all": false
},
"id": {
"type": "long",
"include_in_all": false
},
"pageCode": {
"type": "string",
"term_vector": "with_positions_offsets",
"include_in_all": true
},
"pageSinceVersion": {
"properties": {
"class": {
"type": "string"
},
"id": {
"type": "long"
},
"versionNumber": {
"type": "string"
},
"versionOrder": {
"type": "long"
}
}
},
"pageUptoVersion": {
"properties": {
"class": {
"type": "string"
},
"id": {
"type": "long"
},
"versionNumber": {
"type": "string"
},
"versionOrder": {
"type": "long"
}
}
},
"ref": {
"type": "string",
"index": "no",
"include_in_all": false
}
}
},
"pageVersion": {
"type": "nested",
"properties": {
"class": {
"type": "string",
"index": "no",
"include_in_all": false
},
"id": {
"type": "long",
"include_in_all": false
},
"ref": {
"type": "string",
"index": "no",
"include_in_all": false
},
"versionNumber": {
"type": "string",
"term_vector": "with_positions_offsets",
"include_in_all": true
},
"versionOrder": {
"type": "integer",
"include_in_all": false
}
}
}
}
}
}
}
}
答案 1 :(得分:0)
从第一个屏幕截图中的html中可见,试试这个
第一个:
//tr[@id='attachmentFromPc']//input[@type='file']
对于第二个:
//tr[@id='attachmentFromDlsi']//input[@type='file']
我们可能需要查看层次结构的更大部分以帮助解决问题。从提供的屏幕截图中识别结构有点困难。