Moriba Posted May 28, 2014 Share Posted May 28, 2014 (edited) #include <IE.au3> Local $oIE = _IECreate("http://www.emui.com/plugin.php?id=unlock&mod=detail") Local $ocheckType = _IEGetObjByName($oIE, "checkType") Local $oproductName = _IEGetObjByName($oIE, "productName") Local $osn = _IEGetObjByName($oIE, "sn") Local $oimei = _IEGetObjByName($oIE, "imei") Local $ocheckPassword = _IEGetObjByName($oIE, "checkPassword") _IEFormElementOptionSelect($ocheckType, "智能手机", 1, "byText") _IEFormElementOptionSelect($oproductName, "HUAWEI C8813", 1, "byText") _IEFormElementSetValue($osn, "Z3DBYB9332212412") _IEFormElementSetValue($oimei, "A000004336D50A") _IEFormElementSetValue($ocheckPassword, "42244250") Edited May 28, 2014 by Moriba Link to comment Share on other sites More sharing options...
Danp2 Posted May 28, 2014 Share Posted May 28, 2014 "Doesn't work" isn't very helpful. Run the script in Scite and then post the Output window results. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Moriba Posted May 28, 2014 Author Share Posted May 28, 2014 (edited) No Error In SciTE But Not Select "HUAWEI C8813" Edited May 28, 2014 by Moriba Link to comment Share on other sites More sharing options...
Moriba Posted May 28, 2014 Author Share Posted May 28, 2014 Here my output... >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:Test.au3" /UserParams +>23:51:14 Starting AutoIt3Wrapper v.2.2.0.0 SciTE v.3.4.1.0 Keyboard:00000409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:0409) +> SciTEDir => C:Program Files (x86)AutoIt3SciTE UserDir => C:UsersKyaw Swar ThwinAppDataLocalAutoIt v3SciTEAutoIt3Wrapper SCITE_USERHOME => C:UsersKyaw Swar ThwinAppDataLocalAutoIt v3SciTE >Running AU3Check (3.3.10.2) from:C:Program Files (x86)AutoIt3 input:C:Test.au3 +>23:51:14 AU3Check ended.rc:0 >Running:(3.3.10.2):C:Program Files (x86)AutoIt3autoit3.exe "C:Test.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop +>23:51:15 AutoIt3.exe ended.rc:0 +>23:51:15 AutoIt3Wrapper Finished. >Exit code: 0 Time: 1.868 Link to comment Share on other sites More sharing options...
Danp2 Posted May 28, 2014 Share Posted May 28, 2014 IDK. Are you sure that value is present in the Select element? Does the element update if you run the command?: _IEFormElementOptionSelect($oproductName, 2, 1, "byIndex") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Palestinian Posted May 28, 2014 Share Posted May 28, 2014 2nd drop down menu values gets updated once the 1st drop down menu option is selected, put a sleep between the _IEFormElementOptionSelect for $ocheckType and the $oproductName, or check the contents of the 2nd drop down menu before selecting one. Link to comment Share on other sites More sharing options...
jdelaney Posted May 28, 2014 Share Posted May 28, 2014 Look through the html source...it's possible it may queue off a 'blur' event, which you would have to perform, manually. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Moriba Posted May 29, 2014 Author Share Posted May 29, 2014 This code work. But it is really ugly. #include <IE.au3> For $i = 1 To 2 Local $oIE = _IECreate("http://www.emui.com/plugin.php?id=unlock&mod=detail", 1) If @extended Then Local $oproductName = _IEGetObjByName($oIE, "productName") _IEFormElementOptionSelect($oproductName, "HUAWEI C8813", 1, "byText") Else Local $ocheckType = _IEGetObjByName($oIE, "checkType") _IEFormElementOptionSelect($ocheckType, "智能手机", 1, "byText") EndIf Next Link to comment Share on other sites More sharing options...
Danp2 Posted May 29, 2014 Share Posted May 29, 2014 (edited) Isn't that really the equivalent of this? #include <IE.au3> Local $url = "http://www.emui.com/plugin.php?id=unlock&mod=detail" Local $oIE = _IECreate($url) Local $oproductName = _IEGetObjByName($oIE, "productName") _IEFormElementOptionSelect($oproductName, "HUAWEI C8813", 1, "byText") $oIE = _IEAttach($url, "url") Local $ocheckType = _IEGetObjByName($oIE, "checkType") _IEFormElementOptionSelect($ocheckType, "智能手机", 1, "byText") Edit: Fix foreign characters Edited May 29, 2014 by Danp2 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Moriba Posted May 29, 2014 Author Share Posted May 29, 2014 This code work too. Could anyone better to improve it? #include <IE.au3> Local $oIE = _IECreate("http://www.emui.com/plugin.php?id=unlock&mod=detail") Local $ocheckType = _IEGetObjByName($oIE, "checkType") _IEFormElementOptionSelect($ocheckType, "智能手机", 1, "byText") Local $oIE = _IECreate("http://www.emui.com/plugin.php?id=unlock&mod=detail", 1) Local $oproductName = _IEGetObjByName($oIE, "productName") _IEFormElementOptionSelect($oproductName, "HUAWEI C8813", 1, "byText") Link to comment Share on other sites More sharing options...
Danp2 Posted May 29, 2014 Share Posted May 29, 2014 You should be trying to determine why $oIE is being invalidated by the prior call to _IEFormElementOptionSelect. Perhaps the underlying javascript is refreshing the page... Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now