Posts

Showing posts from November, 2014

Cucumber and Capybara , How to Submit a Form Without a Button

Sometimes We run into  a problem where we need to submit a form after entering data but there is no specific button or link available on which we can perform operation to submit the form.so I am going to suggest few solutions today for these situations in few different ways so that any one can use the solution depending on his specific situation. Where we can hit "Enter" to submit the form: We can access the selenium send_keys method to invoke a return event like  find_field('field2').native.send_key(:enter)   Using  java script:  When /^I submit the form$/ do   page.evaluate_script("document.forms[0].submit()") end   Without Using java Script:      we can handle this directly using Racktest(Capybara's default driver)   When /^I submit the "([^\"]*)" form$/ do |form_id|     element = find_by_id(form_id)     Capybara::RackTest::Form.new(page.driver, element.native).submit :name => nil   end Where we cannot hi

How to Use Object Repository in Xml format In Selenium Webdriver

Image
You can use XML as object repository like    And you can use the code for retrieve the objects from xml below is the code:   A nd you can use as WebDriver d = new FirefoxDriver(); d.get(objRepository(url)); d.findelement(by.name(objRepository(search_TxtFld)).sendkeys("test"); d.findelement(by.name(search_TxtFld(submt)).click();