4
使用Selenium WebDriver,我想处理Facebook身份验证并使用HtmlUnitDriver获取Access Token,我该怎么做?使用Selenium WebDriver的Facebook身份验证
使用Selenium WebDriver,我想处理Facebook身份验证并使用HtmlUnitDriver获取Access Token,我该怎么做?使用Selenium WebDriver的Facebook身份验证
了很多这方面的功能,其目的,你必须推断,但是这是一个测试,我写了OAuth的流程本身:
$this->loginAsTestUser();
$oauth_uri = $this->fbURI()
->setPath('/dialog/oauth')
->addQueryData('client_id', self::RELL_APP_ID)
->addQueryData('redirect_uri', self::RELL_URL);
$this->open($oauth_uri);
$this->platform->tosApp();
$code = $this->getURI()->getQueryData('code');
$this->assertNotEmpty($code, 'No code returned in redirect url');
$token_uri = $this->fbURI('graph')
->setSecure(true)
->setPath('/oauth/access_token')
->addQueryData('client_id', self::RELL_APP_ID)
->addQueryData('client_secret', self::RELL_SECRET)
->addQueryData('code', $code)
->addQueryData('redirect_uri', self::RELL_URL);
$this->open($token_uri);
$this->assertRegExp(
'/access_token=.+/', $this->source(),
'No access token returned in source');
我相信这可以使用HTTP请求是在REST API级别,绕过Selenium执行UI登录? – David