*driver* = whatever variable you use to declare Watir::Browser.new.

For cucumber this variable should be declared in:
*features/support/env.rb*

require 'watir-webdriver'
Before do
  *driver* = Watir::Browser.new
end

You may have:
  *browser* = Watir::Browser.new

resulting in:
  *browser*.action.drag_and_drop(rule, slot).perform


On Tue, Apr 23, 2013 at 7:22 AM, watir webdriver <
[email protected]> wrote:

> Thanks Rich for your email but its throwing below exception...Can you plz
> tell me where i've to define this driver element?
>
>       undefined local variable or method `driver' for #<Object:0x3f9dec0>
> (NameE
> rror)
>       ./features/step_definitions/smartmanager_email_steps.rb:64:in `/^I
> drag "(
>
> .+)" rule to the position (\d+) slot$/'
>       features\smart_manager_email_setup_05.feature:23:in `When I drag
> "Abandone
> d Basket" rule to the position 1 slot'
>
> Implemented as below :
>
> When /^I drag "(.+)" rule to the position (\d+) slot$/ do |algorithm,
> position|
>   index = position.to_i - 1
>   rule = driver.span(:text => algorithm)
>  slot = driver.div(:id => index.to_s)
>  driver.action.drag_and_drop(rule, slot).perform
> end
>
>
> Thanks in advance...
>
>
> On Tue, Apr 23, 2013 at 12:06 PM, Rich Downie <[email protected]>wrote:
>
>> driver.action.drag_and_drop(rule, slot).perform
>>
>>
>> http://selenium.googlecode.com/svn/trunk/docs/api/rb/Selenium/WebDriver/ActionBuilder.html#drag_and_drop-instance_method
>>
>>
>> On Tue, Apr 23, 2013 at 4:07 AM, watir webdriver <
>> [email protected]> wrote:
>>
>>> Any one can help on this?
>>>
>>>
>>> On Wednesday, April 17, 2013, watir webdriver wrote:
>>>
>>>> First of all thanks for the response...Plz find cucumber test,Step
>>>> def,application screenshot,html code and error msg as below.
>>>>
>>>> *Cucumber test :* In my application I've many algorithms out of them
>>>> I've to drag one and drop it to position1 slot.
>>>>
>>>> When I drag "Abandoned Basket" rule to the position 1 slot
>>>>
>>>> *Step def :*
>>>> When /^I drag "(.+)" rule to the position (\d+) slot$/ do |algorithm,
>>>> position|
>>>>   index = position.to_i - 1
>>>>   rule = @browser.span(:text => algorithm)
>>>>   slot = @browser.div(:id => index.to_s)
>>>>   rule.drag_and_drop_on(slot)
>>>> end
>>>>
>>>>
>>>> *Error msg :*
>>>>
>>>>     When I drag "Abandoned Basket" rule to the position 1 slot
>>>>       Cannot perform native interaction: Could not load native events
>>>> component.
>>>>  (Selenium::WebDriver::Error::InvalidElementStateError)
>>>>       [remote server]
>>>> file:///C:/Users/fsultana/AppData/Local/Temp/webdriver-pro
>>>> file20130417-12004-1hejfln/extensions/
>>>> [email protected]/components/driver_
>>>> component.js:8699:in `generateErrorForNativeEvents'
>>>>       [remote server]
>>>> file:///C:/Users/fsultana/AppData/Local/Temp/webdriver-pro
>>>> file20130417-12004-1hejfln/extensions/
>>>> [email protected]/components/driver_
>>>> component.js:8732:in `FirefoxDriver.prototype.mouseMove'
>>>>       [remote server]
>>>> file:///C:/Users/fsultana/AppData/Local/Temp/webdriver-pro
>>>> file20130417-12004-1hejfln/extensions/
>>>> [email protected]/components/command
>>>> _processor.js:10421:in `DelayedCommand.prototype.executeInternal_/h'
>>>>       [remote server]
>>>> file:///C:/Users/fsultana/AppData/Local/Temp/webdriver-pro
>>>> file20130417-12004-1hejfln/extensions/
>>>> [email protected]/components/command
>>>> _processor.js:10426:in `DelayedCommand.prototype.executeInternal_'
>>>>       [remote server]
>>>> file:///C:/Users/fsultana/AppData/Local/Temp/webdriver-pro
>>>> file20130417-12004-1hejfln/extensions/
>>>> [email protected]/components/command
>>>> _processor.js:10366:in `DelayedCommand.prototype.execute/<'
>>>>       ./features/step_definitions/smartmanager_email_steps.rb:63:in
>>>> `/^I drag "(
>>>> .+)" rule to the position (\d+) slot$/'
>>>>       features\smart_manager_email_setup_05.feature:23:in `When I drag
>>>> "Abandone
>>>> d Basket" rule to the position 1 slot'
>>>>
>>>>
>>>> *HTML code:*
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
>>>> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>>>> <html xmlns="http://www.w3.org/1999/xhtml";>
>>>> <head>
>>>> <body>
>>>> <div id="logo">
>>>> <div class="spacersmall"></div>
>>>> <form id="switchSiteShopAdminForm" method="post">
>>>> <div class="spacersmall"></div>
>>>> <div id="header">
>>>> <div id="wrapper">
>>>> <div id="menu">
>>>> <div id="content">
>>>> <ul id="tabs">
>>>> <div class="clear"></div>
>>>> <script type="text/javascript">
>>>> <em id="help" bt-xtitle="" title="">
>>>> <form id="editWidget" method="POST">
>>>> <fieldset class="fieldset">
>>>> <legend>Widget Settings</legend>
>>>> <input type="hidden" value="true" name="active">
>>>> <input id="id" type="hidden" value="-1" name="id">
>>>> <div class="spacer"></div>
>>>> <label for="name">Name</label>
>>>> <input type="text" size="60" maxlength="100" value="" name="name">
>>>> <div class="clear"></div>
>>>> <div class="spacer"></div>
>>>> <p> Two images compose each recommendation. The 1st one is the image of
>>>> the product. The 2nd one is the image of all text that accompany the
>>>> recommended product, i.e. the product title, the product price, a discount
>>>> and so on. In the following section, please define the accompanying text
>>>> styles. Please click "Advanced" to edit the html/css code. In advanced mode
>>>> you will be able to use normal html/css to style these pieces of content.
>>>> The preview pane always reflect your changes, so please feel free to play
>>>> around with the available options, no harm will be done! </p>
>>>> <fieldset id="productStyles" class="fieldset">
>>>> <label for="howMany">Number Of Items</label>
>>>> <input id="howMany" type="text" value="1" name="howMany" size="2">
>>>> <div class="clear"></div>
>>>> <div class="spacer"></div>
>>>> <label for="locale">Locale</label>
>>>> <select name="location">
>>>> <div class="spacer"></div>
>>>> <input id="tags" type="hidden" value="" name="tags">
>>>> <div class="spacer"></div>
>>>> <p>Please insert here any tracking code you want to be added in the
>>>> product link url</p>
>>>> <label for="trackingCode">Tracking Code</label>
>>>> <input id="trackingCode" value="" name="trackingCode">
>>>> <div class="spacer"></div>
>>>> <label for="algorithms">Recommendations</label>
>>>> <div class="spacer"></div>
>>>> <p>
>>>> <div class="spacer"></div>
>>>> <table class="tree2">
>>>> <div class="spacer"></div>
>>>> <div class="t1container">
>>>> <table class="tree1">
>>>> <tbody>
>>>> <tr>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Abandoned Basket"
>>>> aid="ABANDONED_BASKET">Abandoned Basket</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Cross-sell, previous
>>>> purchases and views" aid="OTHER_CUSTOMER_BASKET_ADDITIONS">Cross-sell,
>>>> previous purchases and views</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Other customers popular
>>>> social" aid="OTHER_CUSTOMERS_POPULAR_SOCIAL">Other customers popular
>>>> social</span>
>>>> </td>
>>>> </tr>
>>>> <tr>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Back in stock complementary
>>>> products" aid="BACK_IN_STOCK_COMPLEMENTARY_PRODUCTS">Back in stock
>>>> complementary products</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Customer viewed history"
>>>> aid="CUSTOMER_VIEWED_HISTORY">Customer viewed history</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Popular items from Favourite
>>>> categories" aid="CUSTOMER_PURCHASE_HISTORY">Popular items from Favourite
>>>> categories</span>
>>>> </td>
>>>> </tr>
>>>> <tr>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Back in stock popular
>>>> social" aid="BACK_IN_STOCK_POPULAR_SOCIAL">Back in stock popular
>>>> social</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Emerging products (last 30
>>>> days)" aid="EMERGING_PRODUCTS">Emerging products (last 30 days)</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Product Catalog"
>>>> aid="CATALOG">Product Catalog</span>
>>>> </td>
>>>> </tr>
>>>> <tr>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Best Seller By Revenue in
>>>> Smart Category" aid="BESTSELLER_BY_REVENUE_SMART_CATEGORY">Best Seller By
>>>> Revenue in Smart Category</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Emerging products (last 30
>>>> days) in Smart Category" aid="EMERGING_PRODUCTS_SMART_CATEGORY">Emerging
>>>> products (last 30 days) in Smart Category</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Recently Viewed"
>>>> aid="RECENTLY_VIEWED">Recently Viewed</span>
>>>> </td>
>>>> </tr>
>>>> <tr>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Best Seller by Revenue per
>>>> Product View (last 90 days)" aid="BESTSELLER_BY_REVENUE_PER_VIEW">Best
>>>> Seller by Revenue per Product View (last 90 days)</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="New Products(last 14 days)"
>>>> aid="NEW_PRODUCTS_14Days">New Products(last 14 days)</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Recommendations based on
>>>> Abandoned Basket"
>>>> aid="RECOMMENDATIONS_FOR_ABANDONED_BASKET_PRODUCTS">Recommendations based
>>>> on Abandoned Basket</span>
>>>> </td>
>>>> </tr>
>>>> <tr>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Best Seller by Revenue per
>>>> Product View in Smart Category"
>>>> aid="BESTSELLER_BY_REVENUE_PER_VIEW_SMART_CATEGORY">Best Seller by Revenue
>>>> per Product View in Smart Category</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="New Products(last 30 days)"
>>>> aid="NEW_PRODUCTS_30Days">New Products(last 30 days)</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Registration teaser based on
>>>> basket additions"
>>>> aid="REGISTRATION_TEASER_BASED_ON_BASKET_ADDITIONS">Registration teaser
>>>> based on basket additions</span>
>>>> </td>
>>>> </tr>
>>>> <tr>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Best Sellers by Conversion
>>>> (last 90 days)" aid="BESTSELLER_BY_CONVERSION">Best Sellers by Conversion
>>>> (last 90 days)</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="New Products(last 7 days)"
>>>> aid="NEW_PRODUCTS_7Days">New Products(last 7 days)</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Registration teaser based on
>>>> popular view" aid="REGISTRATION_TEASER_POPULAR_VIEW">Registration teaser
>>>> based on popular view</span>
>>>> </td>
>>>> </tr>
>>>> <tr>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Best Sellers by Conversion
>>>> in Smart Category" aid="BESTSELLER_BY_CONVERSION_SMART_CATEGORY">Best
>>>> Sellers by Conversion in Smart Category</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="New products from favourite
>>>> categories(last 120 days)" aid="NEW_PRODUCTS_FROM_FAV_CATEGORIES">New
>>>> products from favourite categories(last 120 days)</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Wishlist co-purchased"
>>>> aid="WISH_LIST_CO_PURCHASED">Wishlist co-purchased</span>
>>>> </td>
>>>> </tr>
>>>> <tr>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Best Sellers by Revenue (
>>>> last 28 days)" aid="BESTSELLER_BY_REVENUE">Best Sellers by Revenue ( last
>>>> 28 days)</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="New products(last 120 days)
>>>> in Smart Category" aid="NEW_PRODUCTS_SMART_CATEGORY">New products(last 120
>>>> days) in Smart Category</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Wishlist highly viewed"
>>>> aid="WISH_LIST_HIGHLY_VIEWED">Wishlist highly viewed</span>
>>>> </td>
>>>> </tr>
>>>> <tr>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Best Sellers by Units (last
>>>> 7 days)" aid="BESTSELLER_BY_UNITS">Best Sellers by Units (last 7
>>>> days)</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Order Uplifter Bought
>>>> Together" aid="ORDER_UPLIFTER_BOUGHT_TOGETHER">Order Uplifter Bought
>>>> Together</span>
>>>> </td>
>>>> <td></td>
>>>> </tr>
>>>> <tr>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Best Sellers by Units in
>>>> Smart Category" aid="BESTSELLER_BY_UNITS_SMART_CATEGORY">Best Sellers by
>>>> Units in Smart Category</span>
>>>> </td>
>>>> <td>
>>>> <span class="draggable ui-draggable" full="Order Uplifter Popular
>>>> Social" aid="ORDER_UPLIFTER_POPULAR_SOCIAL">Order Uplifter Popular
>>>> Social</span>
>>>> </td>
>>>> <td></td>
>>>> </tr>
>>>> </tbody>
>>>> </table>
>>>> </div>
>>>>
>>>>> Your help is much more appreciated.
>>>>>
>>>>  --
>>>> --
>>>> 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]
>>>>
>>>> ---
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "Watir General" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/watir-general/sIHP_jJDDeg/unsubscribe?hl=en
>>>> .
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> [email protected].
>>>>
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>>
>>>  --
>>> --
>>> 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]
>>>
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "Watir General" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>>
>>
>>
>>
>> --
>> http://www.richdownie.com
>> http://github.com/richdownie
>>
>> --
>> --
>> 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]
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Watir General" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/watir-general/sIHP_jJDDeg/unsubscribe?hl=en
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>  --
> --
> 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]
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Watir General" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
http://www.richdownie.com
http://github.com/richdownie

-- 
-- 
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]

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to