Sign in to follow this  
Followers 0
shura

Need help in finding a parameter ID, or click on a button

3 posts in this topic

#1 ·  Posted (edited)

View Source

post-41910-0-95212300-1417089030_thumb.p

<html dir=rtl><head>
<title>Moovex - מערכת לניהול היסעים בארגון - default</title>
  <meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
  <meta http-equiv="Content-Language" content="he"><META HTTP-EQUIV="EXPIRES" CONTENT="0"><META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE, NO-STORE"><meta name="robots" content="noindex"><meta name="keywords" content=""><meta name="description" content=""><link rel="stylesheet" rel="text/css" href=style.css><link rel="shortcut icon" href="moovex.ico"><style> 
</style>
</head><script language=javascript>if(navigator.appName!="Microsoft Internet Explorer"){alert("IE only");document.location="logo.png";}function autoComplete (field, select, property, forcematch) {  var found = false;  for (var i = 0; i < select.options.length; i++) {if (select.options[i].style.color != '#cccccc' && select.options[i][property].toUpperCase().indexOf(field.value.toUpperCase()) == 0) {found=true; break;}}  if (found) {select.selectedIndex = i;}  else {select.selectedIndex = 0;}  if (field.createTextRange){    if (forcematch && !found) {      field.value = field.value.substring(0,field.value.length-1);       return;}    var cursorKeys ="8;46;37;38;39;40;33;34;35;36;45;";    if (cursorKeys.indexOf(event.keyCode+";") == -1) {      var r1 = field.createTextRange();      var oldValue = r1.text;      var newValue = found ? select.options[i][property] : oldValue;      if (newValue != field.value) {        field.value = newValue;        var rNew = field.createTextRange();        rNew.moveStart('character', oldValue.length) ;        rNew.select();  }}}}</script><script language=vbscript>Function IIf(expr, truepart, falsepart)
   IIf = falsepart
   If expr Then IIf = truepart
End Function
function removelines(byval a, byval t)
  dim r, b, e
  e = "" : r = a & "<br>"
  r = replace(r, "<BR abp", "<br><!")
  do until r = ""
    b = left(r,instr(1,r,"<br>",1)-1)
    r = mid(r,instr(1,r,"<br>",1)+4)
    if instr(1,b,t,1) = 0 then e = e & b & "<br>"
  loop
  if e <> "" then e = left(e,len(e)-4)
  removelines = e
end function
function strfilter(byval a,byval ok_chars)
  dim i, b
  if ok_chars = "" then ok_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
  b = ""
  for i = 1 to len(a)
    if instr(ok_chars, mid(a,i,1)) > 0 then b = b & mid(a,i,1)
  next
  strfilter = b
end function
Function CountString(byval a, byval b)
  if b = "" or a = "" then countstring = 0 : exit function
  dim i
  CountString = 0
  i = 1
  Do Until InStr(i, a, b, 1) = 0
    i = InStr(i, a, b, 1) + Len(b)
    CountString = CountString + 1
  Loop
End Function
function replacefromto(byval a, byval OnlyAfter, byval F, byval T, byval InsertText)
  dim x0, x1, x2, x1a, x2a
  if isnull(a) or isnull(onlyafter) or isnull(f) or isnull(t) or isnull(inserttext) then replacefromto = a : exit function
  if onlyafter = "" then x0 = 0 else x0 = instr(1, a, OnlyAfter, 1) : if x0 = 0 then replacefromto = a : exit function
  x1 = instr(x0 + 1, a, f, 1) : if x1 = 0 then replacefromto = a : exit function
  x2 = instr(x1 + len(f), a, t, 1) + len(t) : if x2 = len(t) then replacefromto = a : exit function
  replacefromto = left(a, x1 - 1) & InsertText & mid(a, x2)
end function
function getfromto(byval a, byval OnlyAfter, byval F, byval T, byval includeF, byval includeT)
  dim x0, x1, x2, x1a, x2a
  if onlyafter = "" then x0 = 0 else x0 = instr(1, a, OnlyAfter, 1) : if x0 = 0 then getfromto = "" : exit function
  x1 = instr(x0 + 1, a, f, 1) : if x1 = 0 then getfromto = "" : exit function
  x2 = instr(x1 + len(f), a, t, 1) + len(t) : if x2 = len(t) then getfromto = "" : exit function
  if not includeF then x1 = x1 + len(F)
  if not includeT then x2 = x2 - len(t)
  getfromto = mid(a, x1, x2 - x1)
end function
Function Curl(byval a)
  dim i,b,ok_chars
  a = CStr(a)
  ok_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
  For i = 1 To Len(a)
    b = Mid(a, i, 1)
    If InStr(ok_chars, b) > 0 Then
      Curl = Curl & b
    Else
      b = Hex(Asc(b))
      If Len(b) = 1 Then b = "0" & b
      Curl = Curl & "%" & b
    End If
  Next
End Function
function getval(byval a,byval b)
  getval = ""
  dim x,y
  a = "|" & a & "|"
  x = instr(1,a,"|" & b & "=",1)
  if x = 0 then exit function
  x = x + len(b) + 2
  y = instr(x,a,"|")
  getval = mid(a,x,y-x)
end function
function setval(ByVal a, ByVal b, ByVal v)
  Dim x, y, t
  If Left(a, "1") <> "|" Then a = "|" & a
  If Right(a, "1") <> "|" Then a = a & "|"
  x = InStr(a, "|" & b & "=")
  If x = 0 Then
    a = a & b & "=" & v & "|"
  Else
    y = InStr(x + 1, a, "|")
    t = b & "=" & v & "|"
    If v = "" Then t = ""
    a = Left(a, x) & t & Mid(a, y)
  End If
  a = Replace(a, "||", "|")
  setval = a
End function
Function lastday(ByVal m)
  Dim y, leapyear
  m = CStr(m)
  If InStr(m, "/") > 0 Then
    y = Mid(m, InStr(m, "/") + 1): m = Left(m, InStr(m, "/") - 1)
    y = CInt("0" & y): If y < 100 Then y = 2000 + y
    leapyear = false : If y / 4 = Fix(y / 4) and not (y / 100 = Fix(y / 100) And y / 400 <> Fix(y / 400)) Then leapyear = True
  End If
  m = cstr(m) : if len(m) = 2 then if left(m,1) = "0" then m = mid(m,2)
  Select Case m
    Case "4", "6", "9", "11": lastday = "30"
    Case "2": lastday = "28"
    Case Else: lastday = "31"
  End Select
  If m = "2" And leapyear Then lastday = "29"
End Function
Function openwin(p)
  dim x, spec
  'spec = "toolbar=yes,scrollbars=yes,left=40,top=40,width=700,height=400,sizable=yes"
  set x = window.open(p,"report1",spec)
End Function
function gethourstring(byval minutes)
  dim hours, t
  if left(minutes,1) = "-" then t = "-" : minutes = mid(minutes,2)
  hours = fix(minutes/60)
  minutes = fix(minutes)
  minutes = minutes - hours * 60
  minutes = cstr(minutes) : if len(minutes) = 1 then minutes = "0" & minutes
  gethourstring = t & hours & ":" & minutes
end function
function getminutestring(byval seconds)
  dim minutes, t
  if left(seconds,1) = "-" then t = "-" : seconds = mid(seconds,2)
  minutes = fix(seconds/60)
  seconds = fix(seconds)
  seconds = seconds - minutes * 60
  seconds = cstr(seconds) : if len(seconds) = 1 then seconds = "0" & seconds
  getminutestring = t & minutes & ":" & seconds
end function
function formatidlistunique(byval d)
  dim b,r
  if isnull(d) then d = ""
  d = strfilter(d,"0123456789,")
  do until instr(d,",,") = 0 : d = replace(d,",,",",") : loop
  if d <> "" and left(d,1) = "," then d = mid(d,2)
  if d <> "" and right(d,1) <> "," then d = d & ","
  r = ""
  do until d = ""
    b = left(d,instr(d,",")-1) : d = mid(d,instr(d,",")+1)
    if instr("," & r, "," & b & ",") = 0 then r = r & b & ","
  loop
  formatidlistunique = r
end function
</script><body rightmargin=0 leftmargin=0 bottommargin=0 topmargin=0  onload='vbscript: document.body.scrolltop = 1' ><table id=toptable style='width:1; position1:absolute; top:0; left:0;'><tr><td style='background=#000000; height=39px;'><tr><td style='background:#eeeeee; border-bottom:1px solid #bbbbbb; height:64px;'></table><script language=vbscript> x = setTimeout("toptable.style.width = document.body.scrollwidth : document.body.scrolltop = 1",1000,"vbscript") </script><table id=tt11 width=100% border=0 style='position:absolute; top:0; left=0; z-index:1;'><tr bgcolor=#000000 height=39><td align=left colspan=2 style='padding:5;'><table border=0 height=100% align=left dir=rtl><tr><td style='padding-left:10;'>&nbsp;&nbsp;&nbsp;<span style='color:#bbbbbb; font-size1:10px;'>v14.11.27</span>&nbsp;&nbsp;&nbsp;<a href=default.asp><img src=logo.png border=0></a></table><table align=right style='margin-top:5; margin-right:10;'><tr><Td></table></tr><form name=f3 action=admin_orders.asp method=post><input type=hidden name=action value=search><input type=hidden name=action2 value=clear><input type=hidden name=ordersview value=all><input type=hidden name=statuses value=''><tr><td style='background:#eeeeee; border-bottom:1px solid #bbbbbb; height:60; padding:10;'><table align=left cellpadding=0 cellspacing=0 border=0><tr><td>&nbsp;&nbsp;&nbsp;<span style='color:#aaaaaa; font-size:10;'>Moovex - מערכת לניהול היסעים בארגון</font>&nbsp;&nbsp;&nbsp;<a href=admin.asp><img border=0 style='margin-left:10;' src=moovex.png height=40></a></table><div style='width:100%; text-align:center; padding-left:300;'><span id=progress style='position:absolute; top:-1000; width:502;'><nobr><span id=progresstext style='padding:2; padding-left:5; padding-right:5; width:120; color:#808080;'></span><span style='width:402; padding:1; background:#f5f5f5; text-align:left; border:1px solid #808080;'><nobr><span id=progressbar style='direction:ltr; height:10; width:1; background:#bbbbff;'></span></span></span></div></tr></form></table><br><br><br><br><table border=0 align=center cellpadding=0 cellspacing=0 dir=rtl><form action=default.asp method=post name=f1 autocomplete=off><input type=hidden name=action value=login_form><input type=hidden name=clientscreenwidth><tr><td><br><center><table border=0 cellpadding=5 cellspacing=0><tr><td>שם המשתמש<td><input type=text name=username style='font-size:17;'><tr><td>סיסמה<td><input type=password name=pass autocomplete=off style='font-size:17;'><tr><td colspan=2><nobr><table align=left><tr><td><a href=forgot.asp><u>שכחת סיסמה?</u></a></table><br><input type=checkbox name=remember> זכור את הסיסמה במחשב הזה<br><input type=checkbox name=delsessionvalues> נקה העדפות<br><tr><td colspan=2 align=left><br><input type=submit style='width:0; height:0; position:absolute; top:-1000;'><div onclick='vbscript: f1.submit' style='cursor:hand; width:120; height:14; color:#ffffff; background:#366CD1; border:1px solid #cccccc; padding:4; white-space:nowrap; font-weight:bold; text-align:center;'>כניסה</div><Tr><td><br><br><Br><Br></table><td width=40><td rowspan=9 valign=top><img src=login2.jpg></table><br><br><br><script language=vbscript> f1.clientscreenwidth.value = screen.width </script><script language=vbscript>f1.username.focus</script></table><center><br><hr style='color:#aaaaaa; height:1;'><font dir=ltr style='font-size:10px; font-weight:normal; color:808080; vertical-align:bottom;'>Powered by <a style='font-size:10;' href=http://axisis.net>Axis I.S. Ltd.</a> | Copyright (c) 2014 | <a target=top href=http://axisis.net/terms.asp style='font-size:10; color:8080ff;'>Terms of use</a></font></center><br><br><br><br>
 

Need help in finding a parameter ID, or click on a button

#include <IE.au3>
#include <TrayConstants.au3>

If Not $CmdLine[0] Then
    MsgBox(16, '', 'No ID of working')
    Exit
 EndIf

Local $sUrl = 'https://kla.moovex.net/';url
Local $oIE, $oTxt, $oBtn
Local $oIE_new, $oTxt_new, $oBtn_new


 $SN = $CmdLine[1]
 $SN = '26993'
Do
;~     $oIE = _IECreate($sUrl)
    $oIE = _IECreate( $sUrl,0,0,0)
$HWND = _IEPropertyGet($oIE, "hwnd")
WinSetState($HWND, "", @SW_MAXIMIZE)
 _IELoadWait($oIE)
    If @error Then ExitLoop
       TrayTip("", "Alex Pougach" & @CR & "KLA-Tencor", 5)
    $oTxt_username = _IEGetObjById($oIE, 'username')
     If @error Then ExitLoop
    _IEFormElementSetValue($oTxt_username, $SN)
    If @error Then ExitLoop
   $oTxt_password = _IEGetObjById($oIE, 'pass')
    If @error Then ExitLoop
    _IEFormElementSetValue( $oTxt_password, $SN)
;~     If @error Then ExitLoop
     $oBtn1 = _IEGetObjById($oIE, 'login2.jpg')
;~       If @error Then ExitLoop
    _IEAction($oBtn1, 'click')
;~     If @error Then ExitLoop
_IELoadWait($oIE)

 Until 1

post-41910-0-86594600-1417088927_thumb.p

Edited by shura

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Your best bet is to use http://www.debugbar.com/ when automating websites.

It makes life soooo much easier when using IE.au3.

Edit:

If items don't have an id or name, there are other options to get the tag names and search for values, types, etc.

Your above item is a submit button, _IEFormSubmit should work.  But you will probably need to get the form object first.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

in this thread

'?do=embed' frameborder='0' data-embedContent>>

you can find examples with

instance:=<nn>

indexrelative:=<nn>

;~ IE definitions
_UIA_setVar("browser1.mainwindow","classname:=IEFrame;controltype:=WindowControl;instance:=1")
_UIA_setVar("browser1.addressbar","Title:=Adresbalk;controltype:=UIA_PaneControlTypeId;class:=Address Band Root;indexrelative:=1")

;~ 2nd and 3rd browser definition (as an example)
_UIA_setVar("browser2.mainwindow","classname:=IEFrame;controltype:=WindowControl;instance:=2")
_UIA_setVar("browser3.mainwindow","classname:=IEFrame;controltype:=WindowControl;instance:=3")

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