首页 > 解决方案 > 我无法使用 selenium 登录星巴克

问题描述

我可以登录其他网站,但 starbucks.com 似乎很特别。该脚本永远停留在登录页面。

这是提交后的截图:

在此处输入图像描述

linux+php+chromedriver+facebook-php-webdriver+selenium

    try{
        $driver->get('https://app.starbucks.com/account/signin?ReturnUrl=https%3A%2F%2Fapp.starbucks.com%2F');
sleep(60);
        $driver->takeScreenshot("s.png");
        $user=$driver->findElement(WebDriverBy::id("username"));
        $user->sendKeys("wild****@gmail.com");
sleep(60);
        $driver->findElement(WebDriverBy::id("password"))->sendKeys("xxxx+")->submit();
sleep(60);
        $driver->wait(60, 1000)->until(
                WebDriverExpectedCondition::titleIs('Starbucks Coffee Company')
        );
        $cookies = $driver->manage()->getCookies();
        print_r($cookies);````

I got a few warnings and a severe from console log, what do those mean?

 [6]=>
  array(3) {
    ["level"]=>
    string(7) "WARNING"
    ["message"]=>
    string(190) "https://jssdkcdns.mparticle.com/js/v2/2689bb1f07a4544aa30798862ab1df07/mparticle.js 28:61854 "The corresponding attribute value of nonInteraction must be a string, number, boolean, or null.""
    ["timestamp"]=>
    int(1562331865383)
  }
  [7]=>
  array(3) {
    ["level"]=>
    string(6) "SEVERE"
    ["message"]=>
    string(157) "https://assets.web.starbucksassets.com/weblx/static/signIn.7ee7f5476580837359aa.chunk.js 0:21324 Uncaught TypeError: Cannot read property 'body' of undefined"
    ["timestamp"]=>
    int(1562331865383)
  }

标签: phpseleniumselenium-chromedriverfacebook-php-webdriver

解决方案


推荐阅读