示例#1
0
 private function GetEtsyShops(\AcceptanceTester $I)
 {
     for ($pg = 1060; $pg <= 1250; $pg++) {
         $I->amOnPage("/search/shops?page=" . $pg);
         $I->waitForElement('.shopname', 100);
         $shops = $I->grabMultiple('.shopname');
         foreach ($shops as $shop) {
             $this->db->real_query("INSERT INTO `etsy_store_list` (`id`, `store_slug`, `from_where`, `sent_at`, `created_at`) VALUES (NULL, '{$shop}', '{$pg}', NULL, CURRENT_TIMESTAMP);");
         }
     }
 }
示例#2
0
 private function CanopyScrapeCest(\AcceptanceTester $I)
 {
     foreach ($this->categories as $category) {
         $I->amOnPage("{$category}/popular");
         $I->waitForElement('.analytics--track-to-amazon', 100);
         try {
             $I->click('.LoadMoreButton');
         } catch (\Exception $e) {
         }
         /*
         $I->wait(5);
         $I->executeJS("window.scrollTo(0,0)");
         $items = $I->grabMultiple('.analytics--track-to-amazon', 'href');
         foreach($items as $item){
             $temp = explode('=',$item);
             $this->db->real_query("INSERT INTO `canopy_item_list` (`id`, `item_slug`, `from_where`, `sent_at`, `created_at`) VALUES (NULL, '{$temp[0]}=', '{$category}', NULL, CURRENT_TIMESTAMP);");
         }
         $I->executeJS("$('.ProductCard').remove()");
         $I->executeJS("window.scrollTo(0,document.body.scrollHeight)");
         $I->waitForElement('.product-card', 100);
         */
         $items = true;
         while ($items) {
             try {
                 $rand_sec = rand(3, 6);
                 $I->wait($rand_sec);
                 // remove for faster scrape
                 $I->executeJS("window.scrollTo(0,0)");
                 $items = $I->grabMultiple('.analytics--track-to-amazon', 'href');
                 foreach ($items as $item) {
                     $temp = explode('=', $item);
                     $this->db->real_query("INSERT INTO `canopy_item_list` (`id`, `item_slug`, `from_where`, `sent_at`, `created_at`) VALUES (NULL, '{$temp[0]}=', '{$category}', NULL, CURRENT_TIMESTAMP);");
                 }
                 $I->executeJS("\$('.ProductCard').remove()");
                 $I->executeJS("window.scrollTo(0,document.body.scrollHeight)");
                 $I->waitForElement('.product-card', 100);
             } catch (\Exception $e) {
                 break;
             }
         }
     }
 }
<?php

$I = new AcceptanceTester($scenario);
$I->login('alumno3', 'pepito.P0', 'ALUMNO 3');
$I->amOnPage('/user/profile.php?id=188');
$I->see('chat');
$courses = $I->grabMultiple('list');
 public function topページ_全件検索(\AcceptanceTester $I)
 {
     $I->wantTo('EF0101-UC03-T01 TOPページ 全件検索');
     $I->amOnPage('/');
     // カテゴリを選択する
     $I->click('#searchform #category_id');
     // 虫眼鏡ボタンを押下する
     $I->click('#searchform .bt_search');
     // 商品一覧の上部に、選択されたカテゴリとその親カテゴリのリンクが表示される
     $I->see('全商品', '#topicpath ol');
     // カテゴリに分類されている商品のみ表示される
     $products = $I->grabMultiple('#item_list .product_item');
     $I->assertTrue(count($products) >= 2);
 }
示例#5
0
$I->wantTo('codeschool login page');
$I->amOnPage('users/sign_in');
$I->fillField('user[login]', '*****@*****.**');
$I->fillField('user[password]', 'netlioo123');
$I->click('Sign In');
$I->see('Dashboard - Code School', 'title');
$I->wantTo('get codeschool courses page');
$I->amOnPage('paths');
$I->wantTo('get database course detail');
$I->amOnPage('paths/database');
//$aLinkText[] = $I->grabMultiple('a','.course-title-link');
//$x[] = $I->seeElement('a', ['class' => 'course-title-link']);
//$x[] = $I->grabAttributeFrom('.course-title-link', 'a');
$basePath = 'https://www.codeschool.com/';
$videos = '/videos';
$texts = $I->grabMultiple('a.course-title-link');
$hrefs = $I->grabMultiple('a.course-title-link', 'href');
//Download HD Quality
foreach ($hrefs as $link) {
    $desiredLink = $link . $videos;
    $I->amOnPage($desiredLink);
    $videoHrefs = $I->grabMultiple('a.js-level-open', 'href');
    foreach ($videoHrefs as $video) {
        $I->wantTo('get real video paths');
        $I->amOnUrl($basePath . $link . $videos . $video);
        $realVideoLink = $I->grabMultiple('iframe.hidden-iframe', 'src');
        dd($realVideoLink);
    }
}
function dd($val)
{
 public function product_商品一覧表示件数(\AcceptanceTester $I)
 {
     $I->wantTo('EF0201-UC04-T01 商品一覧ページ 表示件数');
     $I->amOnPage('/');
     // TOPページ>商品一覧(ヘッダーのいずれかのカテゴリを選択)へ遷移
     $I->moveMouseOver(['css' => '#category .category-nav li:nth-child(2)']);
     $I->wait(3);
     $I->click('#header #category ul li:nth-child(2) a');
     // 各商品のサムネイルが表示される
     $config = Fixtures::get('test_config');
     $productNum = $config['fixture_product_num'] + 2;
     $itemNum = $productNum >= 15 ? 15 : $productNum;
     $products = $I->grabMultiple('#item_list .product_item');
     $I->assertTrue(count($products) == $itemNum);
     // 表示件数の選択リストを変更する
     $I->selectOption(['css' => "#page_navi_top select[name = 'disp_number']"], '30件');
     // 変更された表示件数分が1画面に表示される
     $expected = $productNum >= 30 ? 30 : $productNum;
     $products = $I->grabMultiple('#item_list .product_item');
     $actual = count($products);
     $I->assertEquals($expected, $actual, $expected . ' と ' . $actual . ' が異なります');
 }