*For instance:
That is a label :
<td><span class="fontmd floatleft" id="macbodypage">
<span string="create_user"
class="macstring">Create User</span></span></td>*
*I was reading it:
createUserLbl = $browser.span(:class => "macstring", :string =>
"create_user").text.to_s
puts createUserLbl
*
Try this
require 'watir/webdriver'
require 'watir'
*createUserLbl = $browser.span(:class => "macstring").text*
* puts createUserLbl*
you don't need to convert it into string since it is already a text.
For the watir-webdriver docs, enter this code in the cmd prompt
$ gem server
--note down the port no.
Then open chrome/IE and go to http://localhost:8808 and click on the
watir/webdriver rdoc hyperlink.
Hope that helps.
Thanks
On Mon, Jun 6, 2011 at 11:57 AM, a b <[email protected]>wrote:
> Hi all,
>
> do you know where can we find sone documentation about watir-webdriver?
>
> I decided to go with watir-webdriver.When I run my scripts I can see that
> some components are not recognised the way I used to do
> using firewatir.
>
> For instance:
> That is a label :
> <td><span class="fontmd floatleft" id="macbodypage">
> <span string="create_user"
> class="macstring">Create User</span></span></td>
>
>
> I was reading it:
> createUserLbl = $browser.span(:class => "macstring", :string =>
> "create_user").text.to_s
> puts createUserLbl
>
> Now when I run the script I am receiving::
>
> C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.4/lib/watir-webdriver/locators/elemen
> t_locator.rb:228:in `assert_valid_as_attribute': invalid attribute: :string
> (Watir::Excepti
> on::MissingWayOfFindingObjectException)
> from
> C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.4/lib/watir-webdriver/lo
> cators/element_locator.rb:209:in `normalize_selector'
> from
> C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.4/lib/watir-webdriver/lo
> cators/element_locator.rb:191:in `normalized_selector'
> from
> C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.4/lib/watir-webdriver/lo
> cators/element_locator.rb:188:in `each'
> from
> C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.4/lib/watir-webdriver/lo
> cators/element_locator.rb:188:in `normalized_selector'
> from
> C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.4/lib/watir-webdriver/lo
> cators/element_locator.rb:76:in `find_first_by_multiple'
> from
> C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.4/lib/watir-webdriver/lo
> cators/element_locator.rb:33:in `locate'
> from
> C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.4/lib/watir-webdriver/el
> ements/element.rb:260:in `locate'
> from
> C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.4/lib/watir-webdriver/el
> ements/element.rb:247:in `assert_exists'
> from
> C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.2.4/lib/watir-webdriver/el
> ements/element.rb:59:in `text'
>
>
>
> Reading the last watir book:
> Watir::Exception::MissingWayOfFindingObjectException: invalid attribute:
> string
> Watir-webdriver wants to tell you that it does not support accessing links
> via
> url attribute.
>
>
> I would like to know which attributes are allowed.
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]
>
--
Regards,
Ashok Tulachan
--
Before posting, please read http://watir.com/support. In short: search before
you ask, be nice.
[email protected]
http://groups.google.com/group/watir-general
[email protected]