Trying to do a simple things causing me an issue and need some help.

14 views
Skip to first unread message

Irfan Arif

unread,
Nov 30, 2015, 4:40:43 AM11/30/15
to TestWise
Hi,

I am at the initial stages where I am trying to practice on an eCommerce website .http://store.demoqa.com/

To start with I am using the testwise recorder and seeing if it will work.  The code pasted from the testwise recorder is as below. I am getting the error below where you see failures. The HTML code is also below from the inspector. I have also tried by div_id:account and still not having any luck. Any guidance appreciated.

driver = Selenium::WebDriver.for :firefox # or :ie or :chrome;
driver.find_element(:link_text, "AccountMy Account").click
driver.find_element(:id, "log").send_keys("arifi")
driver.find_element(:id, "pwd").send_keys("asdsddad")


F
Failures:
1) Test Suite New Test Case
Failure/Error: driver.find_element(:link_text, "AccountMy Account").click
Selenium::WebDriver::Error::NoSuchElementError:
Unable to locate element: {"method":"link text","selector":"AccountMy Account"}
# C:/testProjects/testproject/spec/ss_spec.rb:18
Finished in 18.09 seconds (files took 2 minutes 55 seconds to load)
1 example, 1 failure
Failed examples:
rspec C:/testProjects/testproject/spec/ss_spec.rb:15 # Test Suite New Test Case


<header id="header" class="group">
<a id="logo" title="home" href="http://store.demoqa.com">
<div id="header_cart">
<div id="account">
<a class="account_icon" title="My Account" href="http://store.demoqa.com/products-page/your-account/">
<span class="icon" style="margin-top: 0px;">Account</span>
My Account
<span class="shadow"></span>
</a>
</div>
<nav id="main-nav" class="group">
<input id="skins" type

Irfan Arif

unread,
Nov 30, 2015, 8:53:32 AM11/30/15
to TestWise
 Hi All,

Don't worry, got this resolved. Used the class locator and got working although I was expecting id to work.  This was done actually looking at the selenium webdriver recipies book.

Guess being new to all this will be a matter of trial and error.



@driver.find_element(:link_text, "Home").click
    #'@driver.find_element(:id, "account_icon").click
    # The below command has worked in order to move onto the next page providing the login page
    @driver.find_element(:class, "account_icon").click # Submit button
    @driver.find_element(:id, "log").send_keys("asfdsafsfsdf")
    @driver.find_element(:id, "pwd").send_keys("sdfdsfds")
  end

end
Reply all
Reply to author
Forward
0 new messages