开发者

WatiN does not works with LinkedIn OAuth token Access Form

Does WatiN support redirects?

I'm trying to automate testing linked in integration library with WatiN.

// url like "https://api.linkedin.com/uas/oauth/authorize?oauth_token=ba826cd4-644a-4709-b2de-bedb7c8fb5b4"
 using (var ie = new IE(authorizationUrl)) 
 {
    if (ie.TextField("email-oauthAuthorizeForm").Exists 
           && ie.TextField("password-oauthAuthorizeForm").Exists)
    {
         ie.TextField("email-oauthAuthorizeForm").Value = "some@mail.com";
         ie.TextField("password-oauthAuthorizeForm").Value = "password";
         ie.Button(Find.ByName("authorize")).Click();
         //ie.Forms[0].Submit();
    }
}

The button are pressed, and Internet Explorer redirects immediately to the same page. Form sub开发者_Python百科mit have the same behaviour.

What you think about it? Is that WatiN problem or linkedin guard?


Note that LinkedIn's Terms of Service do not allow you to script the authorization flow. We require you to let the user decide to grant or deny access to your integration via the form provided.

If it's automated test suites you're after I'd suggest authorizing an access token once and storing that with your test scripts.


I have seen the behaviour earlier, when the page redirect to the different one.

So you need to create a seperate IE object again for the new url

After page submit

ie.Button(Find.ByName("authorize")).Click(); 

create a new watin session for the new URL

using (var ie = new IE(urredirectedurl))   
{ 
     //ur code
}

I dont know is there any better approaches available, but this works for me..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜