public function testClearSelectedOptions() { $this->writePage(); $this->webdriver->byXpath('//*[@id="select"]/option[1]')->click(); $fast = new FastSelectElement($this->webdriver, '//select[@id="select"]'); $fast->clearSelectedOptions(); $result = $fast->getSelectedOptions(); self::assertCount(0, $result); }
public function testOptionWithParentSelector() { $this->writePage(); $element = $this->byText('Some Text', null, '//select[@id="select2"]'); $element->click(); $select = new FastSelectElement($this->webdriver, '//select[@id="select2"]'); $options = $select->getSelectedOptions(); $option = array_shift($options); self::assertEquals('Some Text', $option['label']); }
protected function enablePaymentMethod($action, $id) { $this->getAction(Login::ACTION)->login(); $this->getNavigator(AdminMenu::NAVIGATOR)->navigateTo('System/Configuration'); $paymentMethod = $this->getAction($action); /* @var $paymentMethod \Magium\Magento\Actions\Admin\Configuration\PaymentMethods\CashOnDelivery */ $paymentMethod->setEnabled(SettingModifier::SETTING_OPTION_YES); $paymentMethod->execute(); $this->getNavigator(SystemConfiguration::NAVIGATOR)->navigateTo('General/Merchant Location'); $this->getNavigator(SystemConfiguration::NAVIGATOR)->navigateTo('Payment Methods/' . $paymentMethod::NAME); $select = new FastSelectElement($this->webdriver, sprintf('//select[@id="%s"]', $id)); $options = $select->getSelectedOptions(); self::assertCount(1, $options); self::assertEquals(1, $options[0]['value']); }