Can you retrieve a redirect URL from a page using Robot automation via python or javascript? -


i'm trying validate page redirect in iframe working correctly. ideally request gets sent server our gateway server, , redirected external page. because of way page handles permissions, best way validate succeeding confirming redirect has occurred , correct url.

using robot / selenium automation, there way grab redirect urls , status codes in order compare them expected value? i've seen mixed answers on whether or not possible.

the javascript navigator object seems might solve problem, i'm not sure how use in context of automation retrieve redirect urls.

any advice appreciated.

as tagged selenium , python, selenium python bindings allow current url with:

driver.current_url 

you use validate url you're looking verify whether redirect resolves right page/url. depending on complexity of you're testing involving iframes , not, selenium might overkill.

if you're looking more general answers far approaching problem of testing redirects in general, i'd recommend looking using requests, offer nice way of handling redirects , providing redirect histories.

you can check requests out here: http://docs.python-requests.org/en/latest/user/quickstart/#redirection-and-history

which found through stack thread: python follow redirects , download page?


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -