Jump to content

Script not able to click on button type


Recommended Posts

I inspect the element and found the below in DOM explorer:

<input onclick="clearSIFields(formx, this, 'fieldsinumber', 12)" type="button" value="Clear Numbers">

and i sent you HTML page..as i am not able to find which is correct element and how to proceed. Please help. I have also sent you what i tried but it is not success.

Link to comment
Share on other sites

You can try to execute the java function directly - "clearSIFields(formx, this, 'fieldsinumber', 12)"

The other ways is to get all INPUT elements , loop truegh them and search for the .Value or innerhtml and execute the onclick event.

Link to comment
Share on other sites

This is how you run a Javascript code:
$oIE.Navigate2("javascript:console.log(123);void(0);")

For the second part - you will have to use _IEFrameGetCollection  first and get the correct frame the button is located in. Then you use the code from your first post.

 

Link to comment
Share on other sites

This is the element for the button:

<input onclick="clearSIFields(formx, this, 'fieldsinumber', 12)" type="button" value="Clear Numbers"> and i am not seen any javascript code for this. Please help me with code to click on this. i have already provide my scripts what i done and HTML page for this. Below only frames i found ,but i have to click on clear number.

image.png.044cefd6f1260bca0ddb9076f6234c34.pngimage.thumb.png.825cb3286ef1d5f610cc6ee49dcd003b.png

Link to comment
Share on other sites

I told you - you need to use _IEFrameGetCollection before your code. Check it out , there is an example. You have 5 frames and need to get the correct frame first.

For the Java - onclick="clearSIFields(formx, this, 'fieldsinumber', 12)"  this is the Java function that is called , but it will be complicated for you to use it. Go with the frames example.

 

Link to comment
Share on other sites

That is the issue i am not able to find the desired elements. As i have already sent the frames info and HTML page of the button and also HTML full page:

<input onclick="clearSIFields(formx, this, 'fieldsinumber', 12)" type="button" value="Clear Numbers">

I need element which will click on this button.As i tried with multiple times with different different elements.

image.png

 

Edited by MRAJ
Link to comment
Share on other sites

Local $oIE = _IECreate($URL,0,1)
Local $hWnd = WinWait("[CLASS:IEFrame]", "", 10)
 WinWaitActive($hWnd)
 Sleep(2000)
 ControlClick($hWnd, "Home - Internet Explorer", "[CLASS:IEFrame; INSTANCE:1]")
 Sleep(2000)

$oButtons = _IETagnameGetCollection($oIE, "input")

For $oButton in $oButtons
  
  If String($oButton.value) = "Clear Numbers" Then

        _IEAction($oButton, "click")

        ExitLoop
   EndIf
Next

This is the code which i tried but it is not working

Link to comment
Share on other sites

I told you before that there is an example in the help file. Why didn't you check it out?

; Open frameset example, get collection of frames
; and loop through them displaying their source URL's

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IE_Example("frameset")
Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
Local $oFrame = 0
For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($oIE, $i)
    $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt)

_IEQuit($oIE)
Link to comment
Share on other sites

 

Sorry mate, but you don't seem at all willing to look anything up, either in the help or on google or other search engines. This makes me very sad.

The horse can be led to water but you cannot make him drink. I turned my kid, from failing into a straight A student. tons more too when I was tutoring mathematics (everything up to and including what I was taking) in college. that was my BEST job ever and MOST rewarding. to give someone the help they need to understand the material, and then watch them go from failing to As and Bs was so rewarding! Nothing else like it, let me tell you. However, we can't help you if you don't want to do any work and even read the stuff others have already pointed you to repeatedly.

PS, the BEST feeling is when your student comes to you and says, I won't need your services anymore (because they were getting great grades--they would think they were hurting my feelings and I would tell them how happy I was instead). best 30 hour per week job ever.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

@Earthshine i do read and trying my level best to achieve but i am not able to find the solution. Its not like i am not reading the post and not trying. Hope you understand me.

Link to comment
Share on other sites

You don't have to try only, you need to think also.

For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($oIE, $i)
    $sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF
Next

Inside the above code you need to put your code from the first post. So that way for each frame found you need to try to get the button you want to click on as you dont know in which frame it is located!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...