mirror of
https://github.com/teampoltergeist/poltergeist.git
synced 2022-11-09 12:05:00 -05:00
Click co-ordinates are shown in the debug log.
You can use this in combination with `page.driver.render` to work out where clicks are actually happening if you are having trouble.
This commit is contained in:
parent
7218290098
commit
1ef674b9df
5 changed files with 18 additions and 7 deletions
|
@ -183,6 +183,12 @@ makes debugging easier). Running `rake autocompile` will watch the
|
|||
|
||||
### 0.8.0 ###
|
||||
|
||||
#### Features ####
|
||||
|
||||
* Click co-ordinates are shown in the debug log. You can use this in
|
||||
combination with `page.driver.render` to work out where clicks are
|
||||
actually happening if you are having trouble.
|
||||
|
||||
#### Bug fixes ####
|
||||
|
||||
* Prevent `TypeError: 'undefined' is not an object (evaluating
|
||||
|
|
|
@ -19,7 +19,7 @@ class Poltergeist.Browser
|
|||
|
||||
@page.onLoadFinished = (status) =>
|
||||
if @state == 'loading'
|
||||
this.sendResponse(status)
|
||||
this.sendResponse(status: status, click: @last_click)
|
||||
@state = 'default'
|
||||
|
||||
@page.onInitialized = =>
|
||||
|
@ -119,11 +119,11 @@ class Poltergeist.Browser
|
|||
# state and wait for onLoadFinished before sending a response.
|
||||
@state = 'clicked'
|
||||
|
||||
node.click()
|
||||
@last_click = node.click()
|
||||
|
||||
if @state != 'loading'
|
||||
@state = 'default'
|
||||
this.sendResponse(true)
|
||||
this.sendResponse(@last_click)
|
||||
|
||||
drag: (page_id, id, other_id) ->
|
||||
this.node(page_id, id).dragTo this.node(page_id, other_id)
|
||||
|
|
|
@ -28,7 +28,10 @@ Poltergeist.Browser = (function() {
|
|||
};
|
||||
this.page.onLoadFinished = function(status) {
|
||||
if (_this.state === 'loading') {
|
||||
_this.sendResponse(status);
|
||||
_this.sendResponse({
|
||||
status: status,
|
||||
click: _this.last_click
|
||||
});
|
||||
return _this.state = 'default';
|
||||
}
|
||||
};
|
||||
|
@ -152,10 +155,10 @@ Poltergeist.Browser = (function() {
|
|||
var node;
|
||||
node = this.node(page_id, id);
|
||||
this.state = 'clicked';
|
||||
node.click();
|
||||
this.last_click = node.click();
|
||||
if (this.state !== 'loading') {
|
||||
this.state = 'default';
|
||||
return this.sendResponse(true);
|
||||
return this.sendResponse(this.last_click);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -47,7 +47,8 @@ Poltergeist.Node = (function() {
|
|||
pos = this.clickPosition();
|
||||
test = this.clickTest(pos.x, pos.y);
|
||||
if (test.status === 'success') {
|
||||
return this.page.mouseEvent('click', pos.x, pos.y);
|
||||
this.page.mouseEvent('click', pos.x, pos.y);
|
||||
return pos;
|
||||
} else {
|
||||
throw new Poltergeist.ClickFailed(test.selector, pos);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ class Poltergeist.Node
|
|||
|
||||
if test.status == 'success'
|
||||
@page.mouseEvent('click', pos.x, pos.y)
|
||||
pos
|
||||
else
|
||||
throw new Poltergeist.ClickFailed(test.selector, pos)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue