在我的應用程序中,我遇到了casperjs
中的問題。在casperjs中找不到元素即使assertExist爲true
我正在做的步驟如下。
1)首先我是斷言,無論元素是否存在。
casper.then(function() {
this.test.assertExists(
{ type: 'xpath', path: '//header[@id="masthead"]/section[3]/div/div/nav/ul[1]/li[2]/a[1]' },
'the element exists'
);
});
輸出:通過
2)單擊元素
casper.then(function() {
this.click(x('//header[@id="masthead"]/section[3]/div/div/nav/ul[1]/li[2]/a[1]'));
this.echo('clicking product and services enter code here page');
});
輸出:點擊產品和服務頁面
3)拍攝圖像。
casper.then(function() {
this.echo("Capturing image website");
this.capture('images/po/productServices.png', {
top: 0,
left: 0,
width: 0,
height: 0
});
});
輸出:圖像不是隨着什麼我想要什麼時候點擊該元素。
請幫我解決這個問題。
感謝, Narasaiah p