本文整理汇总了PHP中AcceptanceTester::grabAttributeFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP AcceptanceTester::grabAttributeFrom方法的具体用法?PHP AcceptanceTester::grabAttributeFrom怎么用?PHP AcceptanceTester::grabAttributeFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AcceptanceTester
的用法示例。
在下文中一共展示了AcceptanceTester::grabAttributeFrom方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addShipmentToNewOrder
public function addShipmentToNewOrder(AcceptanceTester $I)
{
$I->addProductToCartAndCheckout();
$orderId = $I->grabAttributeFrom('#new-order-number', 'data-order-id');
$referenceNumber = $I->grabAttributeFrom('#new-order-number', 'data-reference-number');
$I->amOnPage('/admin/order/view/' . $orderId);
$I->see('Order #' . $referenceNumber);
$I->see('Pending', '.order-status');
$I->addShipmentTrackingCode();
$I->buyShippingLabel();
}
示例2: AmazonScrapeCest
private function AmazonScrapeCest(\AcceptanceTester $I)
{
$result = $this->db->query("SELECT * FROM `canopy_item_list`");
//$result = $this->db->query("SELECT * FROM `canopy_item_list` GROUP BY `from_where`");
//$urls = array('http://www.amazon.com/dp/B00HDGJY8S/?tag=','http://www.amazon.com/dp/B00R4O97ZE/?tag=','http://www.amazon.com/dp/B004LRPVM0/?tag=','http://www.amazon.com/dp/B00MKAJP0E/?tag=','http://www.amazon.com/dp/B00KCG10T2/?tag=','http://www.amazon.com/dp/B00JD2LKD2/?tag=','http://www.amazon.com/dp/1477800670/?tag=','http://www.amazon.com/dp/B001797M6S/?tag=','http://www.amazon.com/dp/0316378216/?tag=','http://www.amazon.com/dp/1616892323/?tag=','http://www.amazon.com/dp/B00LW3RCW8?tag=');
while ($row = $result->fetch_assoc()) {
$temp = explode('/', $row['item_slug']);
$id = $temp[4];
$item_info['title'] = '';
$item_info['price'] = '';
$item_info['image_data'] = '';
$I->amOnPage("dp/{$id}");
try {
$I->waitForElement('#productTitle', 10);
$item_info['title'] = $this->db->real_escape_string($I->grabTextFrom('#productTitle'));
} catch (\Exception $e) {
}
try {
$item_info['price'] = $I->grabTextFrom('#priceblock_ourprice');
} catch (\Exception $e) {
try {
$item_info['price'] = $I->grabTextFrom('.header-price');
} catch (\Exception $e) {
try {
$item_info['price'] = $I->grabTextFrom('#buybox .a-color-price');
} catch (\Exception $e) {
try {
$item_info['price'] = $I->grabTextFrom('#unqualifiedBuyBox .a-color-price');
} catch (\Exception $e) {
}
}
}
}
try {
$item_info['image_data'] = $I->grabAttributeFrom('#imgTagWrapperId img', 'data-a-dynamic-image');
} catch (\Exception $e) {
try {
$item_info['image_data'] = $I->grabAttributeFrom('#mainImageContainer img', 'data-a-dynamic-image');
} catch (\Exception $e) {
try {
$item_info['image_data'] = $I->grabAttributeFrom('#img-canvas img', 'data-a-dynamic-image');
} catch (\Exception $e) {
}
}
}
$sql = "UPDATE `canopy_item_list` SET `title`='{$item_info['title']}',`price`='{$item_info['price']}',`image_data`='{$item_info['image_data']}' WHERE `item_slug`='{$row['item_slug']}'";
//codecept_debug($sql);
$this->db->real_query($sql);
$rand_sec = rand(3, 6);
$I->wait($rand_sec);
// remove for faster scrape
}
}
示例3: cloneInvoice
public function cloneInvoice(AcceptanceTester $I)
{
$I->wantTo('clone an invoice');
$I->amOnPage('/invoices/1/clone');
$invoiceNumber = $I->grabAttributeFrom('#invoice_number', 'value');
$I->executeJS('submitAction()');
$I->wait(1);
$I->see($invoiceNumber);
}
示例4: savePostOnPage
private function savePostOnPage(\AcceptanceTester $I)
{
codecept_debug('savePostOnPage');
$I->amOnPage('/post/' . $this->post_id);
// page
$I->waitForElement('.save[data-id="' . $this->post_id . '"]', 10);
$I->click('.save[data-id="' . $this->post_id . '"]');
$I->waitForElement('.save-it:first-child', 10);
$savegroup_slug = $I->grabAttributeFrom('.save-it:first-child', 'data-slug');
$savegroup_id = $I->grabAttributeFrom('.save-it:first-child', 'data-gid');
$I->click('.save-it:first-child');
$I->amOnPage('/' . $this->user_slug . '/savegroups/' . $savegroup_slug);
$I->waitForElement('.post[data-id="' . $this->post_id . '"]', 10);
}
示例5: AcceptanceTester
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('check if logo links to startpage');
$I->amOnPage('/');
$I->waitForElement('h1');
$href = $I->grabAttributeFrom('#logo', 'href');
$this->assertEquals('https://typo3.org/', $href);
示例6: CheckInFrontEnd
/**
* Checking current parameters in frontend
* first time goes "processing order" page by clicking, other times goes to "processing order" page immediately
* if you want to skip verifying of some parameters type null
* verify one payment if string or many if array transmitted
*
* @version 1.1
*
* @param object $I Controller
* @param string $DeliveryName Delivery name
* @param string $description Description
* @param float|int|string $price Delivery price
* @param float|int|string $freefrom Delivery free from
* @param string $message Delivery sum specified message
* @param string|array $pays Delivery Payment methods, which will included, if passed string : "_" - delimiter for few methods
* @param string $selectpay Pass to select method, confirm the order and verify payment
* @return void
*/
protected function CheckInFrontEnd(AcceptanceTester $I, $DeliveryName, $description = null, $price = null, $freefrom = null, $message = null, $pays = null, $selectpay = null)
{
static $WasCalled = FALSE;
if (!$WasCalled) {
$I->amOnPage('/shop/product/mobilnyi-telefon-sony-xperia-v-lt25i-black');
/**
* @var string buy button "buy"
* @var string basket button "into basket"
* @var string $Attribute1 class of "buy" button
*/
$buy = "//div[@class='frame-prices-buy f-s_0']//form/div[3]";
//button "buy"
$basket = "//div[@class='frame-prices-buy f-s_0']//form/div[2]";
//button "into basket"
$Attribute1 = $I->grabAttributeFrom($buy, 'class');
//class of "buy" button
//$Attribute2 = $I->grabAttributeFrom($basket,'class'); //class of "into basket" button
$I->wait(5);
$Attribute1 == 'btn-buy-p btn-buy' ? $I->click($buy) : $I->click($basket);
$I->waitForElementVisible("//*[@id='popupCart']");
$I->wait(3);
$I->click(".btn-cart.btn-cart-p.f_r");
} else {
$I->amOnPage("/shop/cart");
}
$WasCalled = TRUE;
$present = FALSE;
$I->waitForText('Оформление заказа');
$DeliveriesInProcessingOrderPageAmount = $I->grabClassCount($I, 'name-count');
for ($j = 1; $j <= $DeliveriesInProcessingOrderPageAmount; ++$j) {
$GrabbedName = $I->grabTextFrom("//div[@class='frame-radio']/div[{$j}]//span[@class='text-el']");
if ($GrabbedName == $DeliveryName) {
$present = TRUE;
break;
}
}
$present ? $I->assertEquals($DeliveryName, $GrabbedName) : $I->fail("Delivery method isn't present in front end");
if ($description) {
$GrabbedDescription = $I->grabAttributeFrom("//div[@class='frame-radio']/div[{$j}]//span[@class='icon_ask']", 'data-title');
$I->assertEquals($GrabbedDescription, $description, "description is the same as desired");
}
if ($price) {
$GrabbedPrice = $I->grabTextFrom("//div[@class='frame-radio']/div[{$j}]/div[@class='help-block']/div[1]");
$GrabbedPrice = preg_replace('/[^0-9.]*/u', '', $GrabbedPrice);
$price = ceil($price);
$I->assertEquals($GrabbedPrice, $price, "price is the same as desired");
}
if ($freefrom) {
$Grabbedfreefrom = $I->grabTextFrom("//div[@class='frame-radio']/div[{$j}]/div[@class='help-block']/div[2]");
$Grabbedfreefrom = preg_replace('/[^0-9.]*/u', '', $Grabbedfreefrom);
$freefrom = ceil($freefrom);
$I->assertEquals($Grabbedfreefrom, $freefrom, "price is the same as desired");
}
if ($message) {
$Cmessage = $I->grabTextFrom("//div[@class='frame-radio']/div[{$j}]/div[@class='help-block']");
$I->comment($Cmessage);
$I->assertEquals($Cmessage, $message, "price specified messege is the same as desired");
}
if ($pays) {
// $JQScrollToclick = "$('html,body').animate({scrollTop:$('div.frame-radio>div:nth-child($j)').offset().top});";
$I->scrollToElement($I, "div[class=\\'frame-radio\\'] div:nth-child(1) span[class=\\'text-el\\']");
//scroll for click
$I->wait(5);
$I->click("//div[@class='frame-radio']/div[{$j}]//span[@class='text-el']");
$I->scrollToElement($I, '.frame-payment.p_r');
if ($pays == 'off') {
$I->waitForText('Нет способов оплаты', NULL, '//div[@class="frame-form-field"]/div[@class="help-block"]');
$I->see('Нет способов оплаты', '//div[@class="frame-form-field"]/div[@class="help-block"]');
} else {
$I->waitForElementVisible("#cuselFrame-paymentMethod");
$I->click(".cuselText");
foreach ((array) $pays as $key => $pay) {
$GrabbedPay = $I->grabTextFrom("//div[@id='cusel-scroll-paymentMethod']/span[{$key}+1]");
$I->assertEquals($GrabbedPay, $pay);
}
}
}
if (isset($selectpay)) {
//$JQScrollToclick = "$('html,body').animate({scrollTop:$('div.frame-radio>div:nth-child($j)').offset().top});";
$I->scrollToElement($I, "div[class=\\'frame-radio\\'] div:nth-child(1) span[class=\\'text-el\\']");
//scroll for click
$I->wait(5);
//.........这里部分代码省略.........
示例7:
public function systeminfo_メンバー管理自ユーザー削除(\AcceptanceTester $I)
{
$I->wantTo('EA0802-UC01-T07 メンバー管理 - 自ユーザー削除');
// 表示
$config = Fixtures::get('config');
$I->amOnPage('/' . $config['admin_route'] . '/setting/system/member');
$I->see('システム設定メンバー管理', '#main .page-header');
$I->click('#main #member_list__menu_box--2 a');
$I->see('削除', '#main #member_list__menu--2 li:nth-child(2) a');
$href = $I->grabAttributeFrom('#main #member_list__menu--2 li:nth-child(2) a', 'href');
$I->assertEquals('', $href, $href . ' が一致しません');
}
示例8: AcceptanceTester
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('log in');
$I->amOnPage('/benachrichtigungen');
$I->fillField('email', 'user@example.com');
$I->fillField('password', '1234');
$I->submitForm('#login', [], $I->grabAttributeFrom('#login', 'name'));
$I->see('Benachrichtigungen an user@example.com:');
示例9:
public function product_商品詳細サムネイル(\AcceptanceTester $I)
{
$I->wantTo('EF0202-UC01-T03 商品詳細 サムネイル');
$I->amOnPage('/products/detail/2');
$config = Fixtures::get('test_config');
// デフォルトサムネイル表示確認
$img = $I->grabAttributeFrom('#item_photo_area .slick-active img', 'src');
$I->assertEquals('http://' . $config['hostname'] . '/upload/save_image/cafe-1.jpg', $img, $img . ' が見つかりません');
// 2個目のサムネイルクリック
$I->click('#item_photo_area .slick-dots li:nth-child(2) button');
$img = $I->grabAttributeFrom('#item_photo_area .slick-active img', 'src');
$I->assertEquals('http://' . $config['hostname'] . '/upload/save_image/cafe-2.jpg', $img, $img . ' が見つかりません');
}
示例10:
public function product_商品詳細サムネイル(\AcceptanceTester $I)
{
$I->wantTo('EF0202-UC01-T03 商品詳細 サムネイル');
$I->amOnPage('/products/detail/2');
// デフォルトサムネイル表示確認
$img = $I->grabAttributeFrom('#item_photo_area .slick-active img', 'src');
$I->assertRegExp('/\\/upload\\/save_image\\/cafe-1\\.jpg$/', $img, $img . ' が見つかりません');
// 2個目のサムネイルクリック
$I->click('#item_photo_area .slick-dots li:nth-child(2) button');
$img = $I->grabAttributeFrom('#item_photo_area .slick-active img', 'src');
$I->assertRegExp('/\\/upload\\/save_image\\/cafe-2\\.jpg$/', $img, $img . ' が見つかりません');
}