How to check the redirect url ?
See original GitHub issueHi, I’ve just started looking at protractor for our single page angularjs app. I met a problem now. In our login page, we have a logo, and when you click it, it will redirect you to the homepage of the company, it’s not the same url as the app’s.
My code in it:
element(by.id('Home')).click();
ptor.sleep(10000);
var expectedUrl = ptor.getCurrentUrl();
expect(expectedUrl).toEqual('www.globalpaymentsinc.com');
I believe it’s about the promise in Angular, sounds like getCurrentUrl will always get the promise Url, but not the redirect url, but I’m not sure how to fix it. I got the error from this code:
Failures:
1) Login Page English Page should redirect to GPN worldwide homepage when clic
k the GPN logo
Message:
Error: Error while waiting for Protractor to sync with the page: {"message"
:"angular is not defined","stackTrace":[{"fileName":"https://www.globalpaymentsi
nc.com/worldwide.html line 68 > Function:4","lineNumber":5,"methodName":"anonymo
us/<"},{"fileName":"https://www.globalpaymentsinc.com/worldwide.html line 68 > F
unction:9","lineNumber":1,"methodName":"anonymous"},{"fileName":"https://www.glo
balpaymentsinc.com/worldwide.html:68","lineNumber":11,"methodName":"handleEvalua
teEvent"}]}
Stacktrace:
Error: Error while waiting for Protractor to sync with the page: {"message"
:"angular is not defined","stackTrace":[{"fileName":"https://www.globalpaymentsi
nc.com/worldwide.html line 68 > Function:4","lineNumber":5,"methodName":"anonymo
us/<"},{"fileName":"https://www.globalpaymentsinc.com/worldwide.html line 68 > F
unction:9","lineNumber":1,"methodName":"anonymous"},{"fileName":"https://www.glo
balpaymentsinc.com/worldwide.html:68","lineNumber":11,"methodName":"handleEvalua
teEvent"}]}
Could anyone help? Thank you in advance.
Issue Analytics
- State:
- Created 9 years ago
- Comments:5
Top Results From Across the Web
Redirect Checker | Check your Statuscode 301 vs 302
add http:// or https:// on your URL. Redirect Checker Options: You what to check your redirect with a specific user-agent. Just select the...
Read more >WhereGoes: Tiny URL Expander | Redirect Checker
When the link checker traces a link, the results display all the links that you are being redirected through including php redirects, htaccess...
Read more >Redirect Checker | Check the redirection of URLs
Enter the domain in the given URL field. · Click the “Check Redirection” button. · The results will be displayed on your device...
Read more >URL Redirection Checker - Geekflare Tools
This tool is designed to trace the URL's path with status code and headers. Simply put, it shows all the hops it takes...
Read more >How to Find All URL Redirects - Small Business - Chron.com
You can use the Windows advanced search function to find all of your website files that contain a redirect function. The Windows advanced...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Use this instead - browser.driver.getCurrentUrl() it works for Non-angular pages like login page.
What if this was not the login page and just another angular page? What would be the implementation to check if the user has landed on the correct page or not if I wanted use the URL to do this validation. Like say for example : user is on page 1, clicks on a link and lands on page 2- use the URL to validate if he has landed on page 2 or not. Here is the code, I but doesn’t seem to be working