我正在为我的网站进行自动功能测试。我有内容,如here。我想在那里模拟鼠标左键并粘贴这些数据(例如):
<cml><MDocument><MChemicalStruct><molecule molID="m1"><atomArray><atom id="a1" elementType="C" x2="-1.958426666665918" y2="1.165093321012586"/><atom id="a2" elementType="C" x2="-3.2919733226642123" y2="0.39509332717258694"/><atom id="a3" elementType="C" x2="-3.2919733226642123" y2="-1.145093327172587"/><atom id="a4" elementType="C" x2="-1.958426666665918" y2="-1.915093321012587"/><atom id="a5" elementType="C" x2="-0.6246933440024536" y2="-1.145093327172587"/><atom id="a6" elementType="C" x2="-0.6246933440024536" y2="0.39509332717258694"/><atom id="a7" elementType="C" x2="-4.756475622357591" y2="0.8710857706922682"/><atom id="a8" elementType="C" x2="-5.6617938117211795" y2="-0.3747067232897079"/><atom id="a9" elementType="N" x2="-4.756723285285446" y2="-1.6206038846117412" lonePair="1"/></atomArray><bondArray><bond atomRefs2="a1 a2" order="2" id="b1"/><bond atomRefs2="a2 a3" order="1" id="b2"/><bond atomRefs2="a3 a4" order="2" id="b3"/><bond atomRefs2="a4 a5" order="1" id="b4"/><bond atomRefs2="a5 a6" order="2" id="b5"/><bond atomRefs2="a6 a1" order="1" id="b6"/><bond atomRefs2="a7 a8" order="2" id="b7"/><bond atomRefs2="a2 a7" order="1" id="b8"/><bond atomRefs2="a8 a9" order="1" id="b9"/><bond atomRefs2="a3 a9" order="1" id="b10"/></bondArray></molecule></MChemicalStruct><MElectronContainer occupation="0 0" radical="0" id="o1"><MElectron atomRefs="m1.a9" difLoc="0.0 0.0 0.0"/><MElectron atomRefs="m1.a9" difLoc="0.0 0.0 0.0"/></MElectronContainer></MDocument></cml>
此代码正常工作:
#include <IE.au3>
main()
func main()
local $sQuery = "<cml><MDocument><MChemicalStruct><molecule molID=""m1""><atomArray><atom id=""a1"" elementType=""C"" x2=""-1.958426666665918"" y2=""1.165093321012586""/><atom id=""a2"" elementType=""C"" x2=""-3.2919733226642123"" y2=""0.39509332717258694""/><atom id=""a3"" elementType=""C"" x2=""-3.2919733226642123"" y2=""-1.145093327172587""/><atom id=""a4"" elementType=""C"" x2=""-1.958426666665918"" y2=""-1.915093321012587""/><atom id=""a5"" elementType=""C"" x2=""-0.6246933440024536"" y2=""-1.145093327172587""/><atom id=""a6"" elementType=""C"" x2=""-0.6246933440024536"" y2=""0.39509332717258694""/><atom id=""a7"" elementType=""C"" x2=""-4.756475622357591"" y2=""0.8710857706922682""/><atom id=""a8"" elementType=""C"" x2=""-5.6617938117211795"" y2=""-0.3747067232897079""/><atom id=""a9"" elementType=""N"" x2=""-4.756723285285446"" y2=""-1.6206038846117412"" lonePair=""1""/></atomArray><bondArray><bond atomRefs2=""a1 a2"" order=""2"" id=""b1""/><bond atomRefs2=""a2 a3"" order=""1"" id=""b2""/><bond atomRefs2=""a3 a4"" order=""2"" id=""b3""/><bond atomRefs2=""a4 a5"" order=""1"" id=""b4""/><bond atomRefs2=""a5 a6"" order=""2"" id=""b5""/><bond atomRefs2=""a6 a1"" order=""1"" id=""b6""/><bond atomRefs2=""a7 a8"" order=""2"" id=""b7""/><bond atomRefs2=""a2 a7"" order=""1"" id=""b8""/><bond atomRefs2=""a8 a9"" order=""1"" id=""b9""/><bond atomRefs2=""a3 a9"" order=""1"" id=""b10""/></bondArray></molecule></MChemicalStruct><MElectronContainer occupation=""0 0"" radical=""0"" id=""o1""><MElectron atomRefs=""m1.a9"" difLoc=""0.0 0.0 0.0""/><MElectron atomRefs=""m1.a9"" difLoc=""0.0 0.0 0.0""/></MElectronContainer></MDocument></cml>"
local $oIE = _IECreate ()
_IENavigate ($oIE, "https://marvinjs-demo.chemaxon.com/latest/demo.html", 0)
_IELoadWait($oIE)
MouseClick("left", 403, 572, 1, 1)
ClipPut($sQuery)
Send("^v")
;Some other stuff to do
endfunc
但是我想避免在测试中使用鼠标。
据我了解,数据以某种方式导入到此对象,但我还没有在ie.au3 documentation中找到任何SendToObject()方法。
<canvas width="1198" height="914" class="mjs-canvas" id="canvas" tabindex="0" style="width: 1198px; height: 914px;"></canvas>
或者它应该与json一起发送到服务器?我在哪里可以得到一些与此问题相关的信息?如何影响解决方案?
感谢您的关注。