Как мне установить эту переменную селектора для работы в CasperJS (работает в консоли Chrome)?
document.querySelectorAll('[data-product-unique-key="4_0_1"] [pf-aria-text="widgets.efgenericproduct.paymentaccount.Movements"]')[0]
Вот результат теста:
FAIL Find an element matching: ('[data-product-unique-key="4_0_1"] [pf-aria-text="widgets.efgenericproduct.paymentaccount.Movements"]')[0]
# type: assertExists
# file: /home//dev/casperjs/ccm/scenarios/global.js
# subject: false
# selector: "('[data-product-unique-key=\"4_0_1\"] [pf-aria-text=\"widgets.efgenericproduct.paymentaccount.Movements\"]')[0]"
Вот мой текущий код:
// I escape the doublequotes using backslash
var btnMovements = "('[data-product-unique-key=\"4_0_1\"] [pf-aria-text=\"widgets.efgenericproduct.paymentaccount.Movements\"]')[0]"
casper.csvexport = function() {
casper.thenOpen('https://www.foobank.com/ap/ba/fp/html/e-finance/assets', function() {
});
casper.waitForSelector(
btnMovements,
function success() {
this.test.assertExists(btnMovements);
this.click(btnMovements);
},
function fail() {
this.test.assertExists(btnMovements);
}
);
};