Note| Text in Blue [#PYTHON], Red [#RUBY], and Orange [#JAVA] can be edited or mentioned important for the entire blog. All the posts are practically done by me.
Add below snippet in the step definition file,
yourpage_data = PageName.new(@driver)
case event
when "position"
yourpage_data.select_by_position(value, dropdown)
when "value"
yourpage_data.select_by_value(value, dropdown)
else
raise ArgumentError, "can't find the event #{event}"
end
end
Select by position
Make sure you create cucumber steps before step definitions; say,And I select using "position" with data "1" from "your_locator" on the xyz page
your_locator_dropdown = @driver.find_element(:css => "your_css_locator")
your_locator = @driver.find_elements(:css => "your_css_locator")
def select_by_position(value, dropdown)
__send__("#{dropdown}_dropdown").click
__send__("#{dropdown}").each_with_index do |elem, index|
if index == value
elem.click
break
end
end
end
Select by value
Make sure you create cucumber steps before step definitions; say,And I select using "value" with data "demo_value" from "your_locator" on the xyz page
your_locator_dropdown = @driver.find_element(:css => "your_css_locator")
your_locator = @driver.find_elements(:css => "your_css_locator")
def select_by_value(value, dropdown)
__send__("#{dropdown}_dropdown").click
__send__("#{dropdown}").each do |elem|
if elem.attribute("value").to_s == value.to_s
elem.click
break
end
end
end
Select by last value
Make sure you create cucumber steps before step definitions; say,And I select using "last_value" with data "" from "your_locator" on the xyz page
your_locator_dropdown = @driver.find_element(:css => "your_css_locator")
your_locator = @driver.find_elements(:css => "your_css_locator")
def select_by_last_value(dropdown)
__send__("#{dropdown}_dropdown").click
(__send__("#{dropdown}").last).click
end
Select by text
Make sure you create cucumber steps before step definitions; say,And I select using "text" with data "demo_text" from "your_locator" on the xyz page
your_locator_dropdown = @driver.find_element(:css => "your_css_locator")
your_locator = @driver.find_elements(:css => "your_css_locator")
def select_by_text(value, dropdown)
__send__("#{dropdown}_dropdown").click
__send__("#{dropdown}").each do |elem|
if elem.text.to_s == value.to_s
elem.click
break
else
puts "#{elem.text} not matching #{value}"
end
end
end
ReplyDeleteThank you for taking the time to provide us with your valuable information.
Installment loans in Mississippi
Payday loans in Mississippi
Title loans in Mississippi
Very Useful information that i have found. don't stop sharing and Please keep updating us..... Thanks
ReplyDeleteIts fantatic explaintion lot of information gather it...nice article....
ReplyDeleteseo company in Chennai
Nice tutorial iam reading your article really it is very helpful for providing a lot of information about Selenium …. Thank you Please keep share some more…………
ReplyDeleteyou are posting a good information for people and keep maintain and give more update too.
ReplyDeleteseo services india
Excellent blog, just found your tutorials searching and studying a little about selenium webdriver, appium and cucumber. I've installed for android and worked well, but i'm having trouble in how to install and configure this environment for iOS. Do you have any tutorial for iOS? best from Brazil
ReplyDelete
ReplyDeleteIts a wonderful post and very helpful, thanks for all this information. You are including better information regarding this topic in an effective way.Thank you so much
Personal Installment Loans
Title Car loan
Cash Advance Loan
ReplyDeleteThis information is impressive; I am inspired with your post writing style & how continuously you describe this topic.
Pawn Shop
Pawn Loans
Pawn Shops
Pawn Loan
Pawn Shop near me
ReplyDeleteI have really enjoyed reading your blog posts. This information is impressive. I am inspired with your post.. I hope you post again soon.your post is very helpful for me. photos very nice.
Java Training in Chennai
ReplyDeletedecent article which passed on a decent information.awaiting for more updates this way.
Instant tax service
Small Business accounting
Business tax preparation
Business Tax Return
It's A Nice Post Thank You For Sharing....
ReplyDeleteBest Oracle Training in Bangalore
Hi,
ReplyDeleteThanks for sharing this. It is very useful and helpful information... keep sharing.
thank you
Selenium training in Hyderabad
It's A Really Great Post. Looking For Some More Stuff.
ReplyDeleteSEO Training In BTM Layout
Best Digital Marketing Agency
ReplyDeleteGreat Information, Thanks for sharing
Best Digital Marketing company Anantapur
ReplyDeletehelpful information, thanks for writing and share this information
Best Digital Marketing companyTirupati
ReplyDeleteGreat Information, Thanks for sharing
At Coepd - (Center of Excellence for Professional Development) Manual & Selenium testing training program is designed to give participants the skills & knowledge to gain a competitive advantage in starting/enhancing a career in software testing. We provide the attendee's software testing service which is required to ensure that tested applications meet all application requirements. Participants receive up-to-date training in multiple areas in Software Testing and a thorough understanding of real-world projects. Our collaborative ecosystem comprising of Partnerships with Software Companies enables real time software test life cycle experience.
ReplyDeletehttp://www.coepd.com/TestingTraining.aspx