Minor selenium_session updates to alias #visits as #visit, fix the constructor, and successfully locate a field whose label is it's parent. -Lee Bankewitz & Luke Melia
This commit is contained in:
parent
33fdf33c89
commit
46ced27dbd
@ -2,7 +2,7 @@ module Webrat
|
||||
class SeleniumSession < Session
|
||||
|
||||
def initialize(selenium_driver)
|
||||
super
|
||||
super()
|
||||
@selenium = selenium_driver
|
||||
define_location_strategies
|
||||
end
|
||||
@ -11,6 +11,8 @@ module Webrat
|
||||
@selenium.open(url)
|
||||
end
|
||||
|
||||
alias_method :visit, :visits
|
||||
|
||||
def fills_in(field_identifier, options)
|
||||
locator = "webrat=#{Regexp.escape(field_identifier)}"
|
||||
@selenium.type(locator, "#{options[:with]}")
|
||||
@ -99,6 +101,9 @@ module Webrat
|
||||
candidateLabels = candidateLabels.sortBy(function(s) { return s.length * -1; }); //reverse length sort
|
||||
var locatedLabel = candidateLabels.first();
|
||||
var labelFor = locatedLabel.getAttribute('for');
|
||||
if ((labelFor == null) && (locatedLabel.hasChildNodes())) {
|
||||
return locatedLabel.firstChild; //TODO: should find the first form field, not just any node
|
||||
}
|
||||
return selenium.browserbot.locationStrategies['id'].call(this, labelFor, inDocument, inWindow);
|
||||
JS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user