Jump to content

No access to Form in iFrame?


Recommended Posts

Hello everyone,

I used this forum quite often and I could get almost everything done with the help of it. It's really amazing.

 

Right now I'm stucked so hard that I thought it might be helpfull, to create an account and to search for a direct suggestion.

I just can't make it happen to auto-login into the following site: spreadshirt

I'm using it quite often and it's really annoying to login manually. I hope you can send me a solution that solves this specific issue.

 

It looks like that it's a form within an iFrame. I just can't get access to the form within this iFrame.
I saw already similar issues but nothing worked out for me. Strange is also that I got several times an error that comes from the IE.au3 itself:


C:\Program Files (x86)\AutoIt3\Include\IE.au3" (2295) : ==> The requested action with this object has failed.:
$oTemp = $oObject.document.body
$oTemp = $oObject^ ERROR

Not sure if it has something to do with that, but just to mention it at least once (PS: never changed anything in this IE.au3 file.)
 

If someone could send me the code that makes it possible to auto-login (fill the username/password and to submit everything), it would be just amazing.

Tried it already over weeks without success.

Thanks in advance.

Link to comment
Share on other sites

hmm.. not really sure how _IEPropertyGet could help me there. 

I get easily access to the normal 2 forms(1.Find Product/ 2.Subscribe letter) on the main site with _IEFrameGetCollection / _IEFormGetCollection & _IEFormElementSetValue.
But to be able to login you have an generated iFrame above that whole site after clicking on Login (top-right corner) and the functions doesn't find that iFrame Form.

Really curious if anyone can get access and even submit informations into this Login-Form if it's already open.


@Jos
there is no script because it's just one thing that is not working and it's getting the username/password field filled.
If you may have a code that get access /could send a information into this Login-Form , I would really appreciate it.
I doubt that it would be more than 3-4 lines but I'm not able to do it.
 

Link to comment
Share on other sites

  • Developers
1 hour ago, Spok3r said:

there is no script because it's just one thing that is not working and it's getting the username/password field filled.

mmm.  that sounds pretty impossible to me as you have ran into an error running a script...right?
I am not good at guessing so maybe others feel the urge to stab in the dark...not me. ;) 

Jos

Edited by 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.
  :)

Link to comment
Share on other sites

1 hour ago, Jos said:

mmm.  that sounds pretty impossible to me as you have ran into an error running a script...right?
I am not good at guessing so maybe others feel the urge to stab in the dark...not me. ;) 

Jos


It's not that I have an error running a script. 
It's just that I don't have a working script I could show you because I don't have an idea how to do it.

I mean if you go to the website you'll see the "form" after clicking on Login.

The issue is now to "create" a script that can fill the needed information and get it submited.

_IEFrameGetCollection / _IEFormGetCollection is only working for the "forms" that are on the main website (1.Find Product/ 2.Subscribe letter) and not the iFrame login form.

 

Hope it's understandable and clear where the issue is now.
I really hope anyone has a solution therefore and could provide it.

 

PS: Did you even look at the website I've linked to understand my issue?

Link to comment
Share on other sites

  • Developers

Hey listen, You have now typed many sentences and still not posted a script showing the issue ... so wish you success finding your issue. ;) 

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.
  :)

Link to comment
Share on other sites

hmm... no offence but...

I'm still confused why my informations are not enough to understand the issue and be able to help.

The link to the website is even more usefull in case I'm reading the html-code wrong.

 

With this 2 codes I'm able to get access to the 2 forms on the main website.

Local $oIE = _IECreate("https://spreadshirt.com/")
Local $oForm = _IEFormGetCollection($oIE, 0)
Local $oQuery = _IEFormElementGetCollection($oForm, 0)
_IEFormElementSetValue($oQuery, "Product Search")
_IEFormSubmit($oForm)

Local $oIE = _IECreate("https://spreadshirt.com/")
Local $oForm = _IEFormGetCollection($oIE, 1)
Local $oQuery = _IEFormElementGetCollection($oForm, 0)
_IEFormElementSetValue($oQuery, "Subscribe letter")
_IEFormSubmit($oForm)

I just don't get the access to the Login-Form with that method I think it will be generated above the main website as in a iFrame?.

It just doesn't matter what index I'm using for _IEFormGetCollection to get the access therefore...tried up to 5.


Not sure what else I can post so you can try to help me or understand my issue. 🤔

 

PS: I've tested this method with the login form opened (after clicking on Login) to be sure it's really active. It 

Edited by Spok3r
Link to comment
Share on other sites

14 minutes ago, Spok3r said:

I'm still confused why my informations are not enough to understand the issue and be able to help

Because you are asking for help on an issue and expecting us to write code for you without you even showing what you have tried thus far. Sorry, but most folks around here don't just regurgitate code unless the OP (you) show some effort

P.S. I'll take a look now that you've posted some code. First thought is to use iframe name instead of index number.

Link to comment
Share on other sites

Not sure what your code is demonstrating, but it doesn't seem to involve logging into the website. Here's what I came up with to activate the login form --

#include <ie.au3>
Local $lFound = False
Local $oIE = _IECreate("https://spreadshirt.com/")
Local $oDiv = _IEGetObjById($oIE, "login-menu-header")
Local $oDivs = _IETagNameGetCollection($oDiv, "div")

For $oDiv In $oDivs
    If $oDiv.ClassName = "Button" Then
        $oDiv.click()
        Sleep(1000)
        $lFound = True
        ExitLoop
    EndIf
Next

If $lFound Then
    ; Do login stuff here
EndIf

Unfortunately, my initial attempts to access this form have been unsuccessful. Not sure, but it may be due to cross domain security restrictions.

Link to comment
Share on other sites

My problem is exactly the part you've described right now 😅

My code should demostrate the part "; Do login stuff here" 

To activate the login form I had this code:

Local $oIE = _IECreate("https://spreadshirt.com/")

$tags = _IETagNameGetCollection($oIE, "div")
    For $tag in $tags
        $class_value = $tag.className
        If $class_value = "Label" Then
            $sInnerText = _IEPropertyGet($tag,"innertext")
            $sInnerText = StringStripWS($sInnerText,3)
            If $sInnerText == "Login" Then
                _IEAction($tag, "click")                                                                                                                                                                            
            EndIf
        EndIf
    Next

And now.... comes the issue ^^

; Do login stuff here

I just dont get access to this form.

Edited by Spok3r
Link to comment
Share on other sites

1)

Sorry didn't intend to "reinvent you the wheel".
But I think I've mentioned very clear and often where my issue is, from the beginning.
I even mentioned that I had the Login-Form opened, to avoid this.

I was just confused that a script was needed to get people ready to help (even if no idea is available how to script it, from my side).
Therfore I wanted to line up only the most important part with the code I've shown above.

2)

That's a good tipp and I'll try to use it next time, thanks


If anyone has a solution or can assits, I really appreciate any help.

Cheers!

 

Edited by Spok3r
Link to comment
Share on other sites

  • Developers
9 minutes ago, Spok3r said:

But I think I've mentioned very clear and often where my issue is, from the beginning.
I even mentioned that I had the Login-Form opened, to avoid this.

Yea @Danp2, you dumbass, you need to read better before helping.  ( as You noticed, I simply walk away and leave them simmer in their own BS ;) )

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.
  :)

Link to comment
Share on other sites

3 minutes ago, Jos said:

Yea @Danp2, you dumbass, you need to read better before helping.  ( as You noticed, I simply walk away and leave them simmer in their own BS ;) )

yeah, I need to do what you do more with this type of user.... LOL

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

@Spok3r Here for you (based on Danp2 hint sometimes ago) :

#include <Constants.au3>
#include <IE.au3>

Local $oIE = _IECreate("https://spreadshirt.com/")

Local $tags = _IETagNameGetCollection($oIE, "div")
For $tag In $tags
  $class_value = $tag.className
  If $class_value = "Label" Then
    $sInnerText = _IEPropertyGet($tag, "innertext")
    $sInnerText = StringStripWS($sInnerText, 3)
    If $sInnerText = "Login" Then
      _IEAction($tag, "click")
      ExitLoop
    EndIf
  EndIf
Next
_IELoadWait ($oIE)
_IENavigate ($oIE, "https://accounts.spreadshirt.com/login?context=www&amp;lang=en")
$oForm = _IEFormGetCollection ($oIE,0)
$oItem = _IEFormElementGetObjByName ($oForm, "username")
_IEFormElementSetValue ($oItem, "MyUserName")
$oItem = _IEFormElementGetObjByName ($oForm, "password")
_IEFormElementSetValue ($oItem, "MyPassword")
$oItem = _IEFormElementGetObjByName ($oForm, "login-submit")
_IEAction($oItem, "click")

A hint for you, when you request help and someone asks you to provide something, it is simple politeness to agree...

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...