Jump to content
Sign in to follow this  
susu6514

Unable to getobjbyname within a frame

Recommended Posts

Hi,

I have a Netgear router and I want to setup its WAN IP, however, it always can't find the input box if within a frame.

The code which can set the WPethr1 value to 200 is as follow:

CodeA

$sUrl = "http://192.168.1.1"
$oIE = _IECreate ($sUrl,0,1,1)
_IELoadWait ($oIE)
$oFrame = _IEFrameGetObjByName($oIE, "contents")
_IELinkClickByText ($oFrame, "Basic Settings")
_IENavigate ($oIE, "http://192.168.1.1/BAS_ether.htm")
$add=_IEGetObjByName($oIE, "WPethr1")
sleep(2000)
_IEFormElementSetValue ($add, "200")

And following code AutoIt always shows "$_IEStatus_NoMatch (Name: WPethr1, Index: 0)"

CodeB

$sUrl = "http://192.168.1.1"
$oIE = _IECreate ($sUrl,0,1,1)
_IELoadWait ($oIE)
$oFrame = _IEFrameGetObjByName($oIE, "contents")
_IELinkClickByText ($oFrame, "Basic Settings")
$oFrame2 = _IEFrameGetObjByName($oIE, "formframe")
sleep(2000)
$add=_IEGetObjByName($oFrame2,"WPethr1")
_IEFormElementSetValue ($add, "200")

I'm using AutoIt to setup a Netgear router to do some testing. And to configure this router correctly is to setup the values within its frames. That means I cannot use _IENavigate ($oIE, "http://192.168.1.1/BAS_ether.htm") which is mentioned in above codeA. Please will someone help me.

Thank you.

Susu

Share this post


Link to post
Share on other sites

Thank you but still not work.. I used $add = _IETagnameGetCollection ( $oIE, "WPethr", 52 ) but it still returned $_IEStatus_NoMatch (Name: WPethr1, Index: 52)

Following are html elements generated by IE builder.

IE-Builder v2.0.1
Object Type     Object Count 
DispHTMLElementCollection   135
Characteristics of all HTML Elements on page
Index   Tag Name    Id  Extra Information   Object Type
0   HTML                DispHTMLHtmlElement
1   HEAD                DispHTMLHeadElement
2   TITLE               DispHTMLTitleElement
3   LINK                DispHTMLLinkElement
4   SCRIPT              DispHTMLScriptElement
5   SCRIPT              DispHTMLScriptElement
6   META                DispHTMLMetaElement
7   META    GENERATOR           DispHTMLMetaElement
8   BODY                DispHTMLBody
9   FORM                DispHTMLFormElement
10  INPUT   submit_flag     Form Input Type: hiddenValue: ether DispHTMLInputElement
11  SCRIPT              DispHTMLScriptElement
12  INPUT   conflict_wanlan     Form Input Type: hiddenValue: 0 DispHTMLInputElement
13  INPUT   change_wan_type     Form Input Type: hiddenValue: 0 DispHTMLInputElement
14  INPUT   run_test        Form Input Type: hiddenValue: 0 DispHTMLInputElement
15  INPUT   ether_ipaddr        Form Input Type: hiddenValue: 0 DispHTMLInputElement
16  INPUT   ether_subnet        Form Input Type: hiddenValue: 0 DispHTMLInputElement
17  INPUT   ether_gateway       Form Input Type: hiddenValue: 0 DispHTMLInputElement
18  INPUT   ether_dnsaddr1      Form Input Type: hiddenValue: 0 DispHTMLInputElement
19  INPUT   ether_dnsaddr2      Form Input Type: hiddenValue: 0 DispHTMLInputElement
20  INPUT   ether_dnsaddr3      Form Input Type: hiddenValue: 0 DispHTMLInputElement
21  TABLE               DispHTMLTable
22  TBODY               DispHTMLTableSection
23  TR              DispHTMLTableRow
24  TD              DispHTMLTableCell
25  A           Link Text: Account Name (If Required)href: javascript:loadhelp('_BAS_ether','acname'DispHTMLAnchorElement
26  B               DispHTMLPhraseElement
27  TD              DispHTMLTableCell
28  INPUT   system_name     Form Input Type: textValue: 0   DispHTMLInputElement
29  TR              DispHTMLTableRow
30  TD              DispHTMLTableCell
31  A           Link Text: Domain Name (If Required)href: javascript:loadhelp('_BAS_ether','doname')DispHTMLAnchorElement
32  B               DispHTMLPhraseElement
33  TD              DispHTMLTableCell
34  INPUT   domain_name     Form Input Type: textValue: 0   DispHTMLInputElement
35  TR              DispHTMLTableRow
36  TD              DispHTMLTableCell
37  IMG         Img SRC: http://192.168.1.1/liteblue.gifalt Text: 0 DispHTMLImg
38  TR              DispHTMLTableRow
39  TD              DispHTMLTableCell
40  A           Link Text: Internet IP Addresshref: javascript:loadhelp('_BAS_ether','InternetIP')DispHTMLAnchorElement
41  B               DispHTMLPhraseElement
42  TR              DispHTMLTableRow
43  TD              DispHTMLTableCell
44  INPUT   WANAssign       Form Input Type: radioValue: dhcp   DispHTMLInputElement
45  TR              DispHTMLTableRow
46  TD              DispHTMLTableCell
47  INPUT   WANAssign       Form Input Type: radioValue: static DispHTMLInputElement
48  TR              DispHTMLTableRow
49  TD              DispHTMLTableCell
50  IMG         Img SRC: http://192.168.1.1/spacer.gifalt Text: 0   DispHTMLImg
51  TD              DispHTMLTableCell
52  INPUT   WPethr1     Form Input Type: textValue: 0   DispHTMLInputElement
53  INPUT   WPethr2     Form Input Type: textValue: 0   DispHTMLInputElement
54  INPUT   WPethr3     Form Input Type: textValue: 0   DispHTMLInputElement
55  INPUT   WPethr4     Form Input Type: textValue: 0   DispHTMLInputElement
56  TR              DispHTMLTableRow
57  TD              DispHTMLTableCell
58  IMG         Img SRC: http://192.168.1.1/spacer.gifalt Text: 0   DispHTMLImg
59  TD              DispHTMLTableCell
60  INPUT   WMask1      Form Input Type: textValue: 0   DispHTMLInputElement
61  INPUT   WMask2      Form Input Type: textValue: 0   DispHTMLInputElement
62  INPUT   WMask3      Form Input Type: textValue: 0   DispHTMLInputElement
63  INPUT   WMask4      Form Input Type: textValue: 0   DispHTMLInputElement
64  TR              DispHTMLTableRow
65  TD              DispHTMLTableCell
66  IMG         Img SRC: http://192.168.1.1/spacer.gif
alt Text: 0 DispHTMLImg
67  TD              DispHTMLTableCell
68  INPUT   WGateway1       Form Input Type: textValue: 0   DispHTMLInputElement
69  INPUT   WGateway2       Form Input Type: textValue: 0   DispHTMLInputElement
70  INPUT   WGateway3       Form Input Type: textValue: 0   DispHTMLInputElement
71  INPUT   WGateway4       Form Input Type: textValue: 0   DispHTMLInputElement
72  TR              DispHTMLTableRow
73  TD              DispHTMLTableCell
74  IMG         Img SRC: http://192.168.1.1/liteblue.gifalt Text: 0 DispHTMLImg
75  TR              DispHTMLTableRow
76  TD              DispHTMLTableCell
77  A           Link Text: Domain Name Server (DNS) Addresshref: javascript:loadhel
78  B               DispHTMLPhraseElement
79  TR              DispHTMLTableRow
80  TD              DispHTMLTableCell
81  INPUT   DNSAssign       Form Input Type: radioValue: 0  DispHTMLInputElement
82  TR              DispHTMLTableRow
83  TD              DispHTMLTableCell
84  INPUT   DNSAssign       Form Input Type: radioValue: 1  DispHTMLInputElement
85  TR              DispHTMLTableRow
86  TD              DispHTMLTableCell
87  IMG         Img SRC: http://192.168.1.1/spacer.gifalt Text: 0   DispHTMLImg
88  TD              DispHTMLTableCell
89  INPUT   DAddr1      Form Input Type: textValue: 0   DispHTMLInputElement
90  INPUT   DAddr2      Form Input Type: textValue: 0   DispHTMLInputElement
91  INPUT   DAddr3      Form Input Type: textValue: 0   DispHTMLInputElement
92  INPUT   DAddr4      Form Input Type: textValue: 0   DispHTMLInputElement
93  TR              DispHTMLTableRow
94  TD              DispHTMLTableCell
95  IMG         Img SRC: http://192.168.1.1/spacer.gifalt Text: 0   DispHTMLImg
96  TD              DispHTMLTableCell
97  INPUT   PDAddr1     Form Input Type: textValue: 0   DispHTMLInputElement
98  INPUT   PDAddr2     Form Input Type: textValue: 0   DispHTMLInputElement
99  INPUT   PDAddr3     Form Input Type: textValue: 0   DispHTMLInputElement
100 INPUT   PDAddr4     Form Input Type: textValue: 0   DispHTMLInputElement
101 TR      third_dns       DispHTMLTableRow
102 TD              DispHTMLTableCell
103 IMG         Img SRC: http://192.168.1.1/spacer.gifalt Text: 0   DispHTMLImg
104 TD              DispHTMLTableCell
105 INPUT   TDAddr1     Form Input Type: textValue: 0   DispHTMLInputElement
106 INPUT   TDAddr2     Form Input Type: textValue: 0   DispHTMLInputElement
107 INPUT   TDAddr3     Form Input Type: textValue: 0   DispHTMLInputElement
108 INPUT   TDAddr4     Form Input Type: textValue: 0   DispHTMLInputElement
109 TR              DispHTMLTableRow
110 TD              DispHTMLTableCell
111 IMG         Img SRC: http://192.168.1.1/liteblue.gifalt Text: 0 DispHTMLImg
112 TR              DispHTMLTableRow
113 TD              DispHTMLTableCell
114 A           Link Text: Router MAC Addresshref: javascript:loadhelp('_BAS_ether','localaddress') 
115 B               DispHTMLPhraseElement
116 TR              DispHTMLTableRow
117 TD              DispHTMLTableCell
118 INPUT   MACAssign       Form Input Type: radioValue: 0  DispHTMLInputElement
119 TR              DispHTMLTableRow
120 TD              DispHTMLTableCell
121 INPUT   MACAssign       Form Input Type: radioValue: 1  DispHTMLInputElement
122 TR              DispHTMLTableRow
123 TD              DispHTMLTableCell
124 INPUT   MACAssign       Form Input Type: radioValue: 2  DispHTMLInputElement
125 TD              DispHTMLTableCell
126 INPUT   Spoofmac        Form Input Type: textValue: 0   DispHTMLInputElement
127 TR              DispHTMLTableRow
128 TD              DispHTMLTableCell
129 IMG         Img SRC: http://192.168.1.1/liteblue.gifalt Text: 0 DispHTMLImg
130 TR              DispHTMLTableRow
131 TD              DispHTMLTableCell
132 INPUT   Apply       Form Input Type: submitValue: Apply DispHTMLInputElement
133 INPUT   Cancel      Form Input Type: buttonValue: Cancel    DispHTMLInputElement
134 INPUT   Test        Form Input Type: submitValue: Test  DispHTMLInputElement

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...