History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: SEL-243
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Dan Fabulich
Votes: 1
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Selenium

New getCursorPosition doesn't work properly when cursor position has been cleared by unselectText

Created: 24/May/06 01:49 PM   Updated: 20/Nov/06 11:54 AM
Component/s: BrowserBot-Opera
Affects Version/s: 0.7.1
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: 1. HTML File index1837.html (52 kb)



 Description  « Hide
Run TestCusorPosition test in Opera 8. It will fail.

Now try replacing the refreshAndWait call with unselectText (described below). Instead of correctly reporting that there is no cursor, it incorrectly reports that the cursor exists at its previous location, which is definitely incorrect.

No obvious way to fix this; just adding a warning in the docs.

 All   Comments   Work Log   Change History      Sort Order:
Dan Fabulich - 24/May/06 02:40 PM
Here's a command that will unselectText:

Selenium.prototype.doUnselectText = function() {
/**
* Unselects any text that the user has selected.
*/
var win = this.browserbot.getCurrentWindow();
var doc = this.page().currentDocument;
if (doc.selection && doc.selection.empty) {
doc.selection.empty();
doc.selection.clear();
return;
} else if (win.getSelection && win.getSelection().removeAllRanges) {
win.getSelection().removeAllRanges();
return;
}
else if (doc.getSelection && doc.getSelection().removeAllRanges) {
doc.getSelection().removeAllRanges();
return;
}
throw new Error("Couldn't unselect text on this browser!");
}

Note that to add this into selenium and add a test for it, we'd have to add a function that can select text, which will be tricky in Selenese, because you'll have to supply three arguments: locator, start, and end.

Dan Fabulich - 24/May/06 03:15 PM
I've changed this test so we don't actually use unselectText; we just do refreshAndWait instead. This still doesn't work correctly in Opera 8, but this may be fixed in Opera 9.