Patryk

Guys, please help with a loop!

7 posts in this topic

#1 ·  Posted (edited)

Dear Colleagues,

Could you please help me with a following problem?

All I need is a loop which should check if there is a specified text.

Here is the HTML code:

1) Main table class:

<table class="dxgvTable" id="bodyPlaceholder_dgProcessamento_DXMainTable" style="width: 100%; border-collapse: collapse; empty-cells: show;" onclick="aspxGVTableClick('bodyPlaceholder_dgProcessamento', event);" cellspacing="0" cellpadding="0">

2) The loop is supposed to check whether 'Gerado com Successo' text appeared

<tr class="dxgvDataRow tb-grid" id="bodyPlaceholder_dgProcessamento_DXDataRow0">

                                <td class="dxgv" style="border-bottom-width: 0px;">BASE</td><td class="dxgv" style="border-bottom-width: 0px;">13/09/2017 02:31:56</td><td class="dxgv" style="border-bottom-width: 0px;">13/09/2017 02:33:47</td><td class="dxgv" style="border-right-width: 0px; border-bottom-width: 0px;">Gerado com Sucesso</td>

                </tr>

 

3) And after that, it should click 'Close' button

 

Here is the code I have recently written:

Global $oPole1 = _IEGetObjById ($oIE, "bodyPlaceholder_dgProcessamento_DXDataRow15")
Global $oPole2 = _IEGetObjById ($oIE, "bodyPlaceholder_dgProcessamento_DXDataRow16")

And here is the loop:

Local $i = 0
While $i <> 1

If String($oPole1.value) = "Gerado com Sucesso" And String($oPole2.value) = "Gerado com Sucesso"  Then
$i =1
_IEAction ($oClose, "click")
Sleep ( 30000 )

EndIf
WEnd
EndFunc

 

The problem is that I receive error like the type of it should be 'Object'... What went wrong? How am I supposed to reference to a class??

I couldn't find the answer in a Help file..

Thank you in advance!

Edited by Patryk
not enough informations

Share this post


Link to post
Share on other sites



Hi @Patryk, and welcome to the AutoIt forum :)

I noticed that you're italian... Nice to have another italian here! :)

About your error, I'd suggest you to make, always, an error checking!

I.E. : you have _IECreate(), which returns an error... Did you check a possible error? No, you didn't... So, check every function/operation which could tell you what's going on in your script...

:)


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

@FrancescoDiMuro

All I have a problem with is how to reference to the table row in the loop. As I think the problem is with this part:

If String($oPole1.value) = "Gerado com Sucesso" And String($oPole2.value) = "Gerado com Sucesso"

Share this post


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

@FrancescoDiMuro

All I have a problem with is how to reference to the table row in the loop. As I think the problem is with this part:

If String($oPole1.value) = "Gerado com Sucesso" And String($oPole2.value) = "Gerado com Sucesso"

Before all, check what your script is doing :)

Did you do this?


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

2 hours ago, Patryk said:

It shows error like the type should be 'Object'

LIke?  You really need to give the exact errors when you report your issues. ;)

So this likely means that (one) these statements fails:

Global $oPole1 = _IEGetObjById ($oIE, "bodyPlaceholder_dgProcessamento_DXDataRow15")
Global $oPole2 = _IEGetObjById ($oIE, "bodyPlaceholder_dgProcessamento_DXDataRow16")

.. and you really need to add  tests to check whether they were successful or not. From the HelpFIle:

Quote

Return Value

Success: an object variable pointing to the specified Object.
Failure: sets the @error flag to non-zero.
@error: 3 ($_IEStatus_InvalidDataType) - Invalid Data Type
7 ($_IEStatus_NoMatch) - No Match

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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