mercredi 29 novembre 2017

autoit ie send data to web-object

I'm making automatic function tests for my web-site. I have there with content, like here. I'd like to simulate left mouse click there and pasting of this data (for example):

<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>

This code is working preaty fine:

#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, "http://ift.tt/2j2e8sR", 0)
_IELoadWait($oIE)
MouseClick("left", 403, 572, 1, 1)
ClipPut($sQuery)
Send("^v")
;Some other stuff to do
endfunc

But i'd like to avoid using of mouse in tests.

As I understand, data is somehow imported to this object, but I haven't found any SendToObject() methods in ie.au3 documentation.

<canvas width="1198" height="914" class="mjs-canvas" id="canvas" tabindex="0" style="width: 1198px; height: 914px;"></canvas>

Or it should be sent with json to server? Where can I get some related to this issue information? How does influence on a solution?

Thank you for your attention.




Aucun commentaire:

Enregistrer un commentaire