abdulrahmanok

IE Choose element from Menu (Please Read Notice)

16 posts in this topic

#1 ·  Posted (edited)

Welcome all

In previous post I asked for Code to get Text from Menu and a there is a lot of good members who helped me to do this .

And now I want to know If there is any way to chose some Value from menu or not  This is the Menu Source:

<TR>
<TD CLASS="dddefault">
<SELECT NAME="selected_day">
<OPTION VALUE="14-OCT-16">14-OCT-16
<OPTION VALUE="13-OCT-16">13-OCT-16
<OPTION VALUE="12-OCT-16">12-OCT-16
<OPTION VALUE="11-OCT-16">11-OCT-16
<OPTION VALUE="10-OCT-16">10-OCT-16
</SELECT>
</TR>

I want some way to  make 14-OCT-16 or 13-OCT-16... Chosen

I Found this :

But I don't know how to use it with my code..

Solved :

Thanks All For Your efforts and sorry if i Taken from your time

Edited by abdulrahmanok

Share this post


Link to post
Share on other sites



57 minutes ago, abdulrahmanok said:

 This also Didn't work !

Why not?! Post the results from the Scite output window if you want further assistance.

Share this post


Link to post
Share on other sites

It doesn't show any error , also didn't select or change any value :(

 

Share this post


Link to post
Share on other sites

Full page Source :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/transitional.dtd">
<HTML lang="en">
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="Pragma" NAME="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" NAME="Cache-Control" CONTENT="no-cache">
<LINK REL="stylesheet" HREF="/css/web_defaultapp.css" TYPE="text/css">
<LINK REL="stylesheet" HREF="/css/web_defaultprint.css" TYPE="text/css" media="print">
<TITLE>Student Employment Time Attendance</TITLE>
<META HTTP-EQUIV="Content-Script-Type" NAME="Default_Script_Language" CONTENT="text/javascript">
<SCRIPT type="text/javascript" src="https://ff.kis.v2.scr.kaspersky-labs.com/C61E6CFC-A76B-B94B-8A26-DE905AA5D6D2/main.js" charset="UTF-8"></script><script LANGUAGE="JavaScript" TYPE="text/javascript">
<!-- Hide JavaScript from older browsers 
var submitcount=0;
function checkSubmit() {
if (submitcount == 0)
   {
   submitcount++;
   return true;
   }
else
   {
alert("Your changes have already been submitted.");
   return false;
   }
}
//  End script hiding -->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!-- Hide JavaScript from older browsers 
//  Function to open a window
function windowOpen(window_url) {
   helpWin = window.open(window_url,'','toolbar=yes,status=no,scrollbars=yes,menubar=yes,resizable=yes,directories=no,location=no,width=350,height=400');
   if (document.images) { 
       if (helpWin) helpWin.focus()
   }
}
//  End script hiding -->
</SCRIPT>
</HEAD>
<BODY>
<DIV class="headerwrapperdiv">
<DIV class="pageheaderdiv1">
<A HREF="#main_content" onMouseover="window.status='Go to Main Content'; return true" onMouseout="window.status=''; return true" OnFocus="window.status='Go to Main Content'; return true" onBlur="window.status=''; return true" class="skiplinks">Go to Main Content</A>
<H1>myQU Self Service</H1></DIV><DIV class="headerlinksdiv">
<SPAN class="pageheaderlinks2">
<MAP NAME="Module_Navigation_Links_H" title="Module Navigation Links">
<p>
<A HREF="#skip_Module_Navigation_Links_H" onMouseover="window.status='Skip Module Navigation Links'; return true" onMouseout="window.status=''; return true" onFocus="window.status='Skip Module Navigation Links'; return true" onBlur="window.status=''; return true"  class="skiplinks">Skip Module Navigation Links</A>
<TABLE  CLASS="plaintable" SUMMARY="This is main table for displaying Tab Items."
                          WIDTH="100%" cellSpacing=0 cellPadding=0 border=0>
<TR>
<TD CLASS="pldefault">
<TABLE  CLASS="plaintable" SUMMARY="This table displays Tab Items."
                 cellSpacing=0 cellPadding=0 border=0>
<TR>
<td class="taboff" height=22>
<A HREF="/PROD/twbkwbis.P_GenMenu?name=bmenu.P_GenMnu" onMouseover="window.status='Personal Information'; return true" onMouseout="window.status=''; return true" onFocus="window.status='Personal Information'; return true" onBlur="window.status=''; return true" >Personal Information</A>
</TD>
<TD class="bgtaboff" height=22 vAlign="top" align="right">
<IMG SRC="/wtlgifs/web_tab_corner_right.gif" ALT="Tab Corner Right" CLASS="headerImg" TITLE="Tab Corner Right"  NAME="web_tab_corner_right" HSPACE=0 VSPACE=0 BORDER=0 HEIGHT=20 WIDTH=8>
</TD>
<td class="taboff" height=22>
<A HREF="/PROD/twbkwbis.P_GenMenu?name=bmenu.P_StuMainMnu" onMouseover="window.status='Student Registrations and Records'; return true" onMouseout="window.status=''; return true" onFocus="window.status='Student Registrations and Records'; return true" onBlur="window.status=''; return true" >Student Registrations and Records</A>
</TD>
<TD class="bgtaboff" height=22 vAlign="top" align="right">
<IMG SRC="/wtlgifs/web_tab_corner_right.gif" ALT="Tab Corner Right" CLASS="headerImg" TITLE="Tab Corner Right"  NAME="web_tab_corner_right" HSPACE=0 VSPACE=0 BORDER=0 HEIGHT=20 WIDTH=8>
</TD>
<td class="tabon"  height=22>
<A HREF="/PROD/twbkwbis.P_GenMenu?name=bmenu.P_SSMnu" onMouseover="window.status='Student Services'; return true" onMouseout="window.status=''; return true" onFocus="window.status='Student Services'; return true" onBlur="window.status=''; return true" >Student Services</A>
</TD>
<TD class="bgtabon"  height=22 vAlign="top" align="right">
<IMG SRC="/wtlgifs/web_tab_corner_right.gif" ALT="Tab Corner Right" CLASS="headerImg" TITLE="Tab Corner Right"  NAME="web_tab_corner_right" HSPACE=0 VSPACE=0 BORDER=0 HEIGHT=20 WIDTH=8>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD class="bgtabon" width="100%" colSpan=2><IMG SRC="/wtlgifs/web_transparent.gif" ALT="Transparent Image" CLASS="headerImg" TITLE="Transparent Image"  NAME="web_transparent" HSPACE=0 VSPACE=0 BORDER=0 HEIGHT=3 WIDTH=10></TD></TR></TABLE>
</MAP>
</SPAN>
<a name="skip_Module_Navigation_Links_H"></a>
</DIV>
<TABLE  CLASS="plaintable" SUMMARY="This table displays Menu Items and Banner Search textbox."
         WIDTH="100%">
<TR>
<TD CLASS="pldefault">
<DIV class="headerlinksdiv2">
<FORM ACTION="/PROD/twbksrch.P_ShowResults" METHOD="POST">
Search
<SPAN class="fieldlabeltextinvisible"><LABEL for=keyword_in_id><SPAN class="fieldlabeltext">Search</SPAN></LABEL></SPAN>
<INPUT TYPE="text" NAME="KEYWRD_IN" SIZE="20" MAXLENGTH="65" ID="keyword_in_id">
<INPUT TYPE="submit" VALUE="Go">
</FORM>
</div>
</TD>
<TD CLASS="pldefault"><p class="rightaligntext"></p>
<SPAN class="pageheaderlinks">
<A HREF="/PROD/twbksite.P_DispSiteMap?menu_name_in=bmenu.P_MainMnu&amp;depth_in=2&amp;columns_in=3" accesskey="2" class="submenulinktext2">SITE MAP</A>
|
<A HREF="/wtlhelp/twbhhelp.htm" accesskey="H" onClick="popup = window.open('/wtlhelp/twbhhelp.htm', 'PopupPage','height=500,width=450,scrollbars=yes,resizable=yes'); return false" target="_blank" onMouseOver="window.status='';  return true" onMouseOut="window.status=''; return true"onFocus="window.status='';  return true" onBlur="window.status=''; return true"  class="submenulinktext2">HELP</A>
|
<A HREF="twbkwbis.P_Logout" accesskey="3" class="submenulinktext2">EXIT</A>
</span>
</TD>
</TR>
</TABLE>
</DIV>
<DIV class="pagetitlediv">
<TABLE  CLASS="plaintable" SUMMARY="This table displays title and static header displays."
   WIDTH="100%">
<TR>
<TD CLASS="pldefault">
<H2>Student Employment Time Attendance</H2>
</TD>
<TD CLASS="pldefault">
&nbsp;
</TD>
<TD CLASS="pldefault"><p class="rightaligntext"></p>
<DIV class="staticheaders">
201306497 Abdelrahman H. Hussein<br>
Nov 02, 2016 10:12 pm<br>
</div>
</TD>
</TR>
<TR>
<TD class="bg3" width="100%" colSpan=3><IMG SRC="/wtlgifs/web_transparent.gif" ALT="Transparent Image" CLASS="headerImg" TITLE="Transparent Image"  NAME="web_transparent" HSPACE=0 VSPACE=0 BORDER=0 HEIGHT=3 WIDTH=10></TD>
</TR>
</TABLE>
<a name="main_content"></a>
</DIV>
<DIV class="pagebodydiv">
<!--  ** END OF twbkwbis.P_OpenDoc **  -->

<FORM ACTION="/PROD/bwsksest.p_apply" METHOD="POST">
<TABLE  CLASS="datadisplaytable" SUMMARY="This table lists the days for the student." WIDTH = "100%"><CAPTION class="captiontext">Please select a day:</CAPTION>
<TR>
<TD CLASS="dddefault">&nbsp;</TD>
</TR>
<TR>
<TD CLASS="dddefault">
<SELECT NAME="selected_day">
<OPTION VALUE="02-NOV-16">02-NOV-16
<OPTION VALUE="01-NOV-16">01-NOV-16
<OPTION VALUE="31-OCT-16">31-OCT-16
<OPTION VALUE="30-OCT-16">30-OCT-16
<OPTION VALUE="29-OCT-16">29-OCT-16
</SELECT>
</TR>
</TABLE>
<P class="whitespace2">
<INPUT TYPE="hidden" NAME="appl_no" VALUE="4">
<INPUT TYPE="submit" VALUE=" Next">
</FORM>
<A HREF="javascript:history.go(-1)" onMouseOver="window.status='Return to Previous';  return true" onFocus="window.status='Return to Previous';  return true" onMouseOut="window.status='';  return true"onBlur="window.status='';  return true">Return to Previous</A>

<!--  ** START OF twbkwbis.P_CloseDoc **  -->
<TABLE  CLASS="plaintable" SUMMARY="This is table displays line separator at end of the page."
                                             WIDTH="100%" cellSpacing=0 cellPadding=0 border=0><TR><TD class="bgtabon" width="100%" colSpan=2><IMG SRC="/wtlgifs/web_transparent.gif" ALT="Transparent Image" CLASS="headerImg" TITLE="Transparent Image"  NAME="web_transparent" HSPACE=0 VSPACE=0 BORDER=0 HEIGHT=3 WIDTH=10></TD></TR></TABLE>
<A HREF="#top" onMouseover="window.status='Skip to top of page'; return true" onMouseout="window.status=''; return true" OnFocus="window.status='Skip to top of page'; return true" onBlur="window.status=''; return true" class="skiplinks">Skip to top of page</A>
</DIV>
<DIV class="footerbeforediv">

</DIV>
<DIV class="footerafterdiv">

</DIV>
<DIV class="globalafterdiv">

</DIV>
<DIV class="globalfooterdiv">

</DIV>
<DIV class="pagefooterdiv">
<SPAN class="releasetext">Release: 7.3.3</SPAN>
</DIV>
<DIV class="poweredbydiv">
</DIV>
<DIV class="div1"></DIV>
<DIV class="div2"></DIV>
<DIV class="div3"></DIV>
<DIV class="div4"></DIV>
<DIV class="div5"></DIV>
<DIV class="div6"></DIV>
</BODY>
</HTML>

 

Share this post


Link to post
Share on other sites
Quote
$MsgForm = _IEFormGetCollection ("https://mybanner.qu.edu.qa/PROD/bwsksest.p_select_day",0)

This is an invalid command. The first parameter is wrong. Look at the help file for proper use of _IEFormGetCollection.

Share this post


Link to post
Share on other sites
1 hour ago, abdulrahmanok said:

It doesn't show any error

Please read:
 How to use IE.au3  UDF with  AutoIt v3.3.14.x  

 


NEW:     ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button:

Spoiler

Last update: 2016-11-12
Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft Components * TeamViewer API -UDF * JavaManagement UDF * VIES over SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF *

My contribution to others projects: * _sql.au3 UDF  *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, The Art of Computer Programming
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

 

Share this post


Link to post
Share on other sites

@mLipok

Your post is to click in button I don't know how to use it here ..

8 hours ago, Danp2 said:

This is an invalid command. The first parameter is wrong. Look at the help file for proper use of _IEFormGetCollection.

I know its wrong but I wrote it like this because I don't have "Form name" in the Site

Share this post


Link to post
Share on other sites

No..
My post is about how to use _IE functions at all.
Focus on:

; STEP 1
; YOU MUST SET ANY COM ERROR HANDLER IN ONE OF THE FOLLOWING WAY

; STEP 1: CASE 1
; you should set COM Error Handler Function for ie.au3 UDF
_IEErrorHandlerRegister(_User_ErrFunc)

; STEP 1: CASE 2
; eventually if you not want to recieve additional information
; you can use just the same function without parameter
; _IEErrorHandlerRegister()

; STEP 1: CASE 3
; or use your own global COM Error Handler
;~ Global $oCOMErrorHandler = ObjEvent("AutoIt.Error", _User_ErrFunc)

; STEP 2
; if you do not wish to get in Console Output Pane information like the following:
;           --> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
;   You can uncomment this following line:
;       _IEErrorNotify(False)

NEW:     ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button:

Spoiler

Last update: 2016-11-12
Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft Components * TeamViewer API -UDF * JavaManagement UDF * VIES over SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF *

My contribution to others projects: * _sql.au3 UDF  *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, The Art of Computer Programming
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

 

Share this post


Link to post
Share on other sites

#10 ·  Posted

@mLipok

Thank You for reply , but really I don't know how even test you code with my case

Share this post


Link to post
Share on other sites

#11 ·  Posted

8 hours ago, abdulrahmanok said:

I know its wrong but I wrote it like this because I don't have "Form name" in the Site

If you know the code is wrong, then you shouldn't post it and state "This also Didn't work !"

Telling us that something doesn't work is useless without additional details to back up your statement.

Quote
$MsgForm = _IEFormGetCollection ("https://mybanner.qu.edu.qa/PROD/bwsksest.p_select_day",0)

As I stated before, this is an invalid command related to the first parameter. It has nothing to do with not knowing the for name. Assuming that your IE object is contained in the $oIE variable, you would want to write it like this:

$MsgForm = _IEFormGetCollection ($oIE,0)

See the difference? If not, read the help file until you do.

Share this post


Link to post
Share on other sites

#12 ·  Posted

4 hours ago, mLipok said:

No..
My post is about how to use _IE functions at all.
Focus on:

; STEP 1
; YOU MUST SET ANY COM ERROR HANDLER IN ONE OF THE FOLLOWING WAY

; STEP 1: CASE 1
; you should set COM Error Handler Function for ie.au3 UDF
_IEErrorHandlerRegister(_User_ErrFunc)

; STEP 1: CASE 2
; eventually if you not want to recieve additional information
; you can use just the same function without parameter
; _IEErrorHandlerRegister()

; STEP 1: CASE 3
; or use your own global COM Error Handler
;~ Global $oCOMErrorHandler = ObjEvent("AutoIt.Error", _User_ErrFunc)

; STEP 2
; if you do not wish to get in Console Output Pane information like the following:
;           --> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
;   You can uncomment this following line:
;       _IEErrorNotify(False)

If you mean like This :

Local $oIE = _IECreate("https://mybanner.qu.edu.qa/PROD/bwsksest.p_select_day")
    _IELoadWait($oIE)
    Local $sTitle = '[REGEXPTITLE:(?i)(.*mybanner.qu.edu.qa.*Internet Explorer.*)]'
    Local $oIE_Test = _IEAttachToTitle($sTitle)

Local $oForm = _IEFormGetObjByName($oIE_Test, 0)
Local $oSelect = _IEFormElementGetObjByName($oForm, "selected_day")
    _IEFormElementOptionSelect($oSelect, "30-OCT-16", 1, "byText")
        ToolTip("", 0, 0)


Didn't work also :(

 

Share this post


Link to post
Share on other sites

#13 ·  Posted

6 minutes ago, Danp2 said:

If you know the code is wrong, then you shouldn't post it and state "This also Didn't work !"

Telling us that something doesn't work is useless without additional details to back up your statement.

As I stated before, this is an invalid command related to the first parameter. It has nothing to do with not knowing the for name. Assuming that your IE object is contained in the $oIE variable, you would want to write it like this:

$MsgForm = _IEFormGetCollection ($oIE,0)

See the difference? If not, read the help file until you do.

Firstly Welcome back again in post,

Sorry because I make you think like this , What I want to say Is that I tried before This :

Local $oIE = _IECreate("https://mybanner.qu.edu.qa/PROD/bwsksest.p_select_day")    
$MsgForm = _IEFormGetCollection ($oIE,0)
$MsgCountry = _IEFormElementGetObjByName ($MsgForm, "selected_day")
$value = _IEFormElementGetValue ($MsgCountry)
_IEFormElementOptionselect ($MsgCountry, "30-OCT-16", 1, "ByValue")

And I doesn't work Also So I posted Code above..

 

 

Share this post


Link to post
Share on other sites

#14 ·  Posted

27 minutes ago, abdulrahmanok said:

Firstly Welcome back again in post,

Sorry because I make you think like this , What I want to say Is that I tried before This :

Local $oIE = _IECreate("https://mybanner.qu.edu.qa/PROD/bwsksest.p_select_day")    
$MsgForm = _IEFormGetCollection ($oIE,0)
$MsgCountry = _IEFormElementGetObjByName ($MsgForm, "selected_day")
$value = _IEFormElementGetValue ($MsgCountry)
_IEFormElementOptionselect ($MsgCountry, "30-OCT-16", 1, "ByValue")

And I doesn't work Also So I posted Code above..

"Doesn't work" isn't an adequate description of why it is failing. Run the code in Scite and post the results from the output window.

Share this post


Link to post
Share on other sites

#15 ·  Posted

Finally found Solution from old post

Worked Code :

Local $oIE = _IECreate("https://mybanner.qu.edu.qa/PROD/bwsksest.p_select_day")    
$oSelect = _IEGetObjByName($oIE, "selected_day")
    _IEFormElementOptionSelect($oSelect, "01-NOV-16", 1, "byText")

 

My Life Saved in 3 Lines Only :D

Share this post


Link to post
Share on other sites

#16 ·  Posted

Important notice :

Thank you all because you trying to learning me not just give me final code , but I prefers learning by Example

that's why i loved this language (autoit) For Example : I learnt from final code in this post how to get Some Obj From IE by Name ...

1 person likes this

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