Я использую Nightwatch-огурец и объекты страницы, и я изо всех сил пытаюсь заставить локаторы найти мой элемент через Xpath.
элемент выглядит так:
<div class="portal-layout-section" style="width: 1215px; height: 730px; overflow: hidden;">
<div class="item bordered portal-hoverable" style="width: 243px; height: 365px; background-image: url(http://path/to/img/Ironman.jpeg;);"></div>
<div class="item bordered portal-hoverable" style="width: 243px; height: 365px; background-image: url(http://path/to/img/FriendsWithBenefits.jpeg);"></div>
<div class="item bordered portal-hoverable" style="width: 243px; height: 365px; background-image: url(http://path/to/img/Inception.jpeg);"></div></div>
</div>
Мой шаг содержит этот код:
var anonbrowse = this.page.anonbrowse();
anonbrowse
.waitForElementVisible('@cover_images_ironman',5000)
.click('@cover_images_ironman')
А объект Pageobject выглядит так:
module.exports = {
elements: {
cover_images_ironman: {
selector : '//div[contains(@style,"http://path/to/img/Ironman.jpeg")]',
locateStrategy: "xpath"
},
}
}
Я продолжаю получать ошибку тайм-аута независимо от того, как долго я оставляю ожидание:
Timed out while waiting for element <//div[contains(@style,"http://path/to/img//Ironman.jpeg")]> to be present for 5000 milliseconds. - Expected "visible" but got: "not found"
at Object.<anonymous> (c:\nightwatxh\features\step_definitions\anonbrowse_steps.js:21:3)
at next (native)
at next (native)
У кого-нибудь есть идеи, что я делаю неправильно здесь?
//div[contains(@style,"Ironman.jpeg")]
? Спасибо. - person alecxe   schedule 22.12.2016