Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

popup() with SSO authentication scheme - pending checks and more details #311

Closed
Lamarche-Lam opened this issue Sep 28, 2021 · 15 comments
Closed
Labels

Comments

@Lamarche-Lam
Copy link

Hello everyone,

I'm currently working on a script to download contents from the enterprise mail automatically since we need to generate reports from the downloaded contents.

One of our mailbox uses SSO scheme for authorisation purpose and it runs as stated in the following:

  1. I use r.click() in the main tab opened by r.init() after entering my credentials to log in
  2. It pop-ups a new tab with its url ended with /sso and then I redirect to the mailbox page within the tab automatically
  3. Then I tired to use r.popup('url to the mailbox page') to tell tagUI reseting the tab to the newly opened tab
  4. It ended up with error message saying:

[RPA][ERROR] - cannot find popup tab containing URL string 'url to the mailbox page (ended up with .jsp)'

Alternative trial: I've tried r.vision() to send command visually but because of the computer was reinstalled by IT dept. following specific requirements, complex SikuliX command would shut the engine down leaving the whole process wait endlessly...so negativ.

Is there a solution to this? Any help would be appreciated.

Best,
Lamarche

@Lamarche-Lam Lamarche-Lam changed the title popup() with SSO authentication scheme popup() with SSO authentication scheme tag:query Sep 28, 2021
@Lamarche-Lam Lamarche-Lam changed the title popup() with SSO authentication scheme tag:query popup() with SSO authentication scheme Sep 28, 2021
@kensoh
Copy link
Member

kensoh commented Sep 28, 2021

Hi @Lamarche-Lam it sounds like you want to automate on the popup tab with URL ending with /sso. Can you share what is the full URL of the popup tab and main tab? From your description, the step should be below. Also, check this example 2 here.

r.popup('sso')

@kensoh kensoh changed the title popup() with SSO authentication scheme popup() with SSO authentication scheme - pending checks and more details Sep 28, 2021
@kensoh kensoh added the query label Sep 28, 2021
@Lamarche-Lam
Copy link
Author

Lamarche-Lam commented Sep 29, 2021

Hi @Lamarche-Lam it sounds like you want to automate on the popup tab with URL ending with /sso. Can you share what is the full URL of the popup tab and main tab? From your description, the step should be below. Also, check this example 2 here.

r.popup('sso')

Hi @kensoh ,

Not really...
Sorry that I found a typo in the process 2 of my question at

"It pop-ups a new tab with its url ended with /sso and then I redirect to the mailbox page within the tab automatically"

What I actually want to say was

"It pop-ups a new tab with its url ended with /sso and then this newly opened tab redirects to the mailbox page within the tab automatically". The mailbox page has the url with ".jsp" ending.

Can you share what is the full URL of the popup tab and main tab?

Sure, the main tab was:

http://123.456.12.34:3455/hub/

and the main tab opened one popup tab but with two urls in order:

  1. http://123.456.12.34:3455/hub/account/sso
    I checked the JavaServer Pages of http://123.456.12.34:3455/hub/ and I found there was an action when I clicked the button, which was something like:

var form = "form if='form' action='/hub/account/sso' method='post' target='blank'>";

  1. http://123.456.12.44:3499/company/page/main.jsp

the urls were made up but the behaviour of them were well reflected.

Thank you.

@kensoh
Copy link
Member

kensoh commented Sep 29, 2021

I see... Then usage would be like the following -

If you mean after loading http://123.456.12.34:3455/hub/account/sso the webpage automatically redirects to http://123.456.12.44:3499/company/page/main.jsp, then use r.popup('main.jsp').

If you require some manual 2FA action on http://123.456.12.34:3455/hub/account/sso before going to main.jsp, you may want to do a r.wait() for some time to allow you to manually click.

Lastly, if you are planning to automate the clicking to go from sso to main.jsp page, then you can use r.popup('sso') to automate on that page.

@Lamarche-Lam
Copy link
Author

It meets the description of the first scenario but RPA returns error saying it cannot find the popup tab with the url ended with 'main.jsp'.
I used exactly the same command r.popup('main.jsp') as you did but it returned negative.

@kensoh
Copy link
Member

kensoh commented Sep 29, 2021

Oh I see... Can you check this, print(r.tagui_location()). In that folder, there is a tagui or .tagui folder depending on your OS. Then inside there is src\tagui_chrome.log. Can you attach the log file here? It will show the messages from Chrome.

@Lamarche-Lam
Copy link
Author

Lamarche-Lam commented Sep 29, 2021

Oh I see... Can you check this, print(r.tagui_location()). In that folder, there is a tagui or .tagui folder depending on your OS. Then inside there is src\tagui_chrome.log. Can you attach the log file here? It will show the messages from Chrome.

Ohoh, I forgot to mention this. It seemed that the getTarget method not function properly.
When r.popup() works, it would look like:

[tagui] INPUT -
[19] {"id":19,"method":"Target.getTargets","params":{}}
[tagui] OUTPUT -
[19] {"id":19,"result":{"targetInfos":[{"targetId":"0CABB68EA2F1CA7A896DCB11A938C702","type":"page","title":"","url":"https://passport.bilibili.com/login?from_spm_id=333.1007.top_bar.login","attached":false,"openerId":"82BCB9E2D0924FF8ED29176E3C66FED0","canAccessOpener":true,"openerFrameId":"82BCB9E2D0924FF8ED29176E3C66FED0","browserContextId":"F5E9D045F593BF7E5B2981F7321B4507"},{"targetId":"82BCB9E2D0924FF8ED29176E3C66FED0","type":"page","title":"\u54d4\u54e9\u54d4\u54e9 (\u309c-\u309c)\u3064\u30ed \u5e72\u676f~-bilibili","url":"https://www.bilibili.com/","attached":true,"canAccessOpener":false,"browserContextId":"F5E9D045F593BF7E5B2981F7321B4507"}]}}

It showed the url of popup tab first and then the url of main tab.
However, when r.popup() does not work, the urls of popup and main tabs was arranged reversely, it looked like:

[tagui] INPUT -
[19] {"id":19,"method":"Target.getTargets","params":{}}
[tagui] OUTPUT -
[19] {"id":19,"result":{"targetInfos":[{"targetId":"0CABB68EA2F1CA7A896DCB11A938C702","type":"page","title":"the unicode of the tab title","url":"https://www.bilibili.com/"},{"targetId":"82BCB9E2D0924FF8ED29176E3C66FED0","type":"page","title":"the unicode of the tab title","url":"https://passport.bilibili.com/login?from_spm_id=333.1007.top_bar.login"}]}}

In addition, strings like "attached", "openderId", "canAccessOpener", "openerFrameId", "browserContextId" were missing out.

the urls were made up but the behaviour of them were well reflected.

@kensoh
Copy link
Member

kensoh commented Sep 30, 2021

Not sure if above are the real URLs or dummy URLs because no mention of sso or jsp string in URLs.

If the popup URL is https://passport.bilibili.com/login?from_spm_id=333.1007.top_bar.login from above, you can try connecting using r.popup('top_bar.login') to see if it works, since this string does not exist in the main URL.

@kensoh
Copy link
Member

kensoh commented Sep 30, 2021

Adding on to above suggestion, are you able to tell what difference this popup compared to other popups?

Is it look different or the way it appear is special? I don't understand why Chrome responds differently in your logs.

@Lamarche-Lam
Copy link
Author

Not sure if above are the real URLs or dummy URLs because no mention of sso or jsp string in URLs.

If the popup URL is https://passport.bilibili.com/login?from_spm_id=333.1007.top_bar.login from above, you can try connecting using r.popup('top_bar.login') to see if it works, since this string does not exist in the main URL.

Hi @kensoh , These urls from the chrome log were made up, they were not the real urls I encounted with. I just used them as an example to illustrate the problems.
The whole process could be demostrated in the following annomation:
Animation1

The main tab was the "join github" page.
When i click on Terms of Service, it opened a new tab with url as "github.com/site.terms" in a new tab first and then the url changed into "docs.github.com/...." in the same tab.

but in my case, the main tab was http://123.456.12.34:3455/hub/
and it opened a new tab at http://123.456.12.34:3455/hub/account/sso
and the new tab redirected to http://123.456.12.44:3499/company/page/main.jsp automatically.

@Lamarche-Lam
Copy link
Author

Adding on to above suggestion, are you able to tell what difference this popup compared to other popups?

Is it look different or the way it appear is special? I don't understand why Chrome responds differently in your logs.

Adding on to above suggestion, are you able to tell what difference this popup compared to other popups?

Is it look different or the way it appear is special? I don't understand why Chrome responds differently in your logs.

The only difference, I think, the urls of the main tab and the popups in my case was that thery were all internal urls (I worked for a financial entity so everthing i did was in an isolated enviroment) and they were all constructed as some string like ip:port/xxx/xxx/.

@kensoh
Copy link
Member

kensoh commented Sep 30, 2021

I see.. Can you share the full tagui_chrome.log for r.popup('main.jsp')?

Without the full logs to see what is Chrome's response, and without access to your system, I can't think of ways to troubleshoot the problem. Alternatively you can use visual automation and keyboard automation to automate on the new tab, see here - https://github.com/tebelorg/RPA-Python#visual-automationsee_no_evil

@Lamarche-Lam
Copy link
Author

I see.. Can you share the full tagui_chrome.log for r.popup('main.jsp')?

Without the full logs to see what is Chrome's response, and without access to your system, I can't think of ways to troubleshoot the problem. Alternatively you can use visual automation and keyboard automation to automate on the new tab, see here - https://github.com/tebelorg/RPA-Python#visual-automationsee_no_evil

Sorry… I cannot provide you the log file at the moment since due to company’s policy. I would try something else based on you suggestion. Thank you for helping me.

@kensoh
Copy link
Member

kensoh commented Oct 1, 2021

Oh yes, I suspect that is the case. Sure, I hope visual and keyboard automation works for you.

It is very easy to use, just that native web automation is more powerful (especially for reading data).

@kensoh
Copy link
Member

kensoh commented Oct 1, 2021

Do see this section on element identifiers to understand more on visual automation -
https://github.com/tebelorg/RPA-Python#element-identifiers

@Lamarche-Lam
Copy link
Author

Oh yes, I suspect that is the case. Sure, I hope visual and keyboard automation works for you.

It is very easy to use, just that native web automation is more powerful (especially for reading data).

Definitely will try :)

@kensoh kensoh closed this as completed Jan 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants