Jump to content

Recommended Posts

Posted (edited)

 

Hi, I would ask for help. Code below
I do not know why @error does not work. My point is to load another one, it will load another one.
Additional question:
* Can i instead "@error" use "if $ _IESTATUS_NoMatch then" if so how?
* Can i somehow set the script to restart the code after the error has finished

 

#include <IE.au3>

Local $oIE = _IECreate("https://www.google.pl/")
_IELoadWait ($oIE)
Sleep (2000)
_IENavigate ($oIE, "http://moje-asgsdgd")
Sleep (2000)
Local $przycisk = _IEGetObjById ($oIE, "middle-top")
_IEAction ($przycisk, "click")
If @error Then
    _IENavigate ($oIE, "https://www.wp.pl/")
EndIf


Best regards

Edited by MJ36
big fonts edit
  • Developers
Posted

What is the reason you feel you need to shout at us with these big fonts?
Please don't and use the standard forum font unless something needs to be emphasized.  

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

 

But why the DOM of the object this is just an example of such a site does not exist intentionally.
What I mean is that if there is no such page, the script will detect the error and switch to another one

Posted (edited)

I just ran your code above. it works and goes to all the pages. here is the output from the editor console capture

Quote

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "D:\test.au3" /UserParams    
+>10:30:57 Starting AutoIt3Wrapper v.18.708.1148.0 SciTE v.4.1.0.0   Keyboard:00000409  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper
>Running AU3Check (3.3.14.5)  from:C:\Program Files (x86)\AutoIt3  input:D:\test.au3
+>10:30:57 AU3Check ended.rc:0
>Running:(3.3.14.5):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "D:\test.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (middle-top)
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
+>10:31:31 AutoIt3.exe ended.rc:0
+>10:31:31 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 34.81
 

 

test your script on another system.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

  • 1 month later...
Posted (edited)

I'm sorry but I still have not solved the problem. 
of course, as you write, @error is displayed but he does not go to www.wp.pl and that's what I meant

Edited by MJ36
Posted

@MJ36  Ok, I now understand what is your problem.  You see when you navigate to an invalid URL ("http://moje-asgsdgd"), IE won't allow you to navigate to another site.  So you need to return back to the previous valid site by using  Send ("!{LEFT}") 

Personally, I wouldn't use this approach.  I would prefer testing the validity of the URL first.  If valid then navigate and do your stuff.  If not valid then move on to the next site.  

 

Posted

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
  • Recently Browsing   0 members

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