How to use select_by method of Selenium.WebDriver.Support Package

Best Selenium code snippet using Selenium.WebDriver.Support.select_by

Ch_7_Prog_4_Modular_Ruby_Prog.rb

Source:Ch_7_Prog_4_Modular_Ruby_Prog.rb Github

copy

Full Screen

...9899def Buy_Tickets100 @driver.find_element(:name, "login").click101 @driver.find_element(:link, "Flights").click102 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "toDay")).select_by(:text, "15")103 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Returning:'])[1]/following::option[27]").click104 @driver.find_element(:name, "findFlights").click105 @driver.find_element(:name, "reserveFlights").click106 @driver.find_element(:name, "passFirst0").click107 @driver.find_element(:name, "passFirst0").clear108 @driver.find_element(:name, "passFirst0").send_keys "Selenium"109 @driver.find_element(:name, "passLast0").clear110 @driver.find_element(:name, "passLast0").send_keys "User"111 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Bland")112 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Diabetic")113 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Hindu")114 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Kosher")115 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Low Calorie")116 @driver.find_element(:name, "creditnumber").clear117 @driver.find_element(:name, "creditnumber").send_keys "1234567890123456"118 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_mn")).select_by(:text, "01")119 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_mn")).select_by(:text, "02")120 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_mn")).select_by(:text, "03")121 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2000")122 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2001")123 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2002")124 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2003")125 (close_alert_and_get_its_text()).should == "You have entered 2003 as expiration year!"126 @driver.find_element(:name, "cc_exp_dt_yr").click127 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2010")128 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Expiration:'])[1]/following::option[31]").click129 @driver.find_element(:name, "cc_frst_name").click130 @driver.find_element(:name, "cc_frst_name").clear131 @driver.find_element(:name, "cc_frst_name").send_keys "Selenium"132 @driver.find_element(:name, "cc_last_name").clear133 @driver.find_element(:name, "cc_last_name").send_keys "User"134 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='CONTACT'])[1]/following::table[3]").click135 @driver.find_element(:name, "ticketLess").click136 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")137138 @driver.find_element(:name, "buyFlights").click139 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")140end141142def Navigate_Site143 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='CONTACT'])[1]/following::img[3]").click144 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='$584 USD'])[1]/following::img[3]").click145 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Flights'])[1]/following::td[2]").click146 @driver.find_element(:link, "Hotels").click147 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='© 2005, Mercury Interactive (v. 011003-1.01-058)'])[1]/preceding::img[1]").click148 @driver.find_element(:link, "Car Rentals").click149 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='© 2005, Mercury Interactive (v. 011003-1.01-058)'])[1]/preceding::img[1]").click150 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Shipboard accomodations include: all meals, daily activities and nightly entertainment'])[1]/following::img[1]").click151 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::font[3]").click152 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::font[3]").click153 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='CONTACT'])[1]/following::table[3]").click154 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::font[3]").click155 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")156end157158def Navigate_Site_2159 @driver.find_element(:name, "findFlights").click160 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")161 @driver.find_element(:name, "reserveFlights").click162 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Cruises'])[1]/following::td[2]").click163 @driver.find_element(:link, "Cruises").click164 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='© 2005, Mercury Interactive (v. 011003-1.01-058)'])[1]/preceding::img[1]").click165 @driver.find_element(:link, "Cruises").click166 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")167end168169def Navigate_Site_3170 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Shipboard accomodations include: all meals, daily activities and nightly entertainment'])[1]/following::img[1]").click171 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::font[3]").click172 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::font[3]").click173 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::td[2]").click174 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Airline:'])[1]/preceding::input[1]").click175 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Airline:'])[1]/preceding::input[2]").click176 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Airline:'])[1]/preceding::input[1]").click177 @driver.find_element(:name, "passCount").click178 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "passCount")).select_by(:text, "4")179 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")180end181182def Find_Flights183 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Passengers:'])[1]/following::option[4]").click184 @driver.find_element(:name, "toDay").click185 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "toDay")).select_by(:text, "19")186 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Returning:'])[1]/following::option[31]").click187 @driver.find_element(:name, "fromPort").click188 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "fromPort")).select_by(:text, "New York")189 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Passengers:'])[1]/following::option[8]").click190 @driver.find_element(:name, "toPort").click191 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "toPort")).select_by(:text, "Sydney")192 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='On:'])[1]/following::option[52]").click193 @driver.find_element(:name, "findFlights").click194 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")195 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 363'])[1]/preceding::td[1]").click196 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 363'])[1]/preceding::td[1]").click197 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 363'])[1]/preceding::td[1]").click198 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 363'])[1]/preceding::input[1]").click199 @driver.find_element(:name, "results").click200 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")201 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 633'])[1]/preceding::td[1]").click202 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 633'])[1]/preceding::td[1]").click203 @driver.find_element(:xpath, "//td").click204 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 633'])[1]/preceding::input[1]").click205 @driver.find_element(:name, "reserveFlights").click206end207208def Buy_Flight_Tickets209 @driver.find_element(:name, "passFirst0").click210 @driver.find_element(:name, "passFirst0").clear211 @driver.find_element(:name, "passFirst0").send_keys "Selenium"212 @driver.find_element(:name, "passLast0").clear213 @driver.find_element(:name, "passLast0").send_keys "User"214 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")215216 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Bland")217 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Diabetic")218 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Bland")219 @driver.find_element(:name, "passFirst1").clear220 @driver.find_element(:name, "passFirst1").send_keys "Sel"221 @driver.find_element(:name, "passLast1").clear222 @driver.find_element(:name, "passLast1").send_keys "U2"223 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")224225 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.1.meal")).select_by(:text, "Bland")226 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Last Name:'])[2]/following::td[1]").click227 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.1.meal")).select_by(:text, "Diabetic")228 @driver.find_element(:name, "passFirst2").clear229 @driver.find_element(:name, "passFirst2").send_keys "Sel"230 @driver.find_element(:name, "passLast2").clear231 @driver.find_element(:name, "passLast2").send_keys "U3"232 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Bland")233 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Diabetic")234 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Hindu")235 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")236237 @driver.find_element(:name, "passFirst3").clear238 @driver.find_element(:name, "passFirst3").send_keys "Sel"239 @driver.find_element(:name, "passLast3").clear240 @driver.find_element(:name, "passLast3").send_keys "U4"241 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.3.meal")).select_by(:text, "Bland")242 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.3.meal")).select_by(:text, "Diabetic")243 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.3.meal")).select_by(:text, "Hindu")244 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.3.meal")).select_by(:text, "Kosher")245 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.3.meal")).select_by(:text, "Low Calorie")246 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Kosher")247 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Low Calorie")248 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Low Cholesterol")249 @driver.find_element(:name, "creditnumber").clear250 @driver.find_element(:name, "creditnumber").send_keys "123"251 @driver.find_element(:name, "creditnumber").send_keys :down252 @driver.find_element(:name, "creditnumber").send_keys :down253 @driver.find_element(:name, "creditnumber").send_keys :down254 @driver.find_element(:name, "creditnumber").send_keys :tab255 @driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")256257 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_mn")).select_by(:text, "01")258 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2000")259 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2001")260 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2002")261 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2003")262 (close_alert_and_get_its_text()).should == "You have entered 2003 as expiration year!"263 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2004")264 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2005")265 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2006")266 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2007")267 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2008")268 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2009")269 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2010")270 @driver.find_element(:name, "cc_frst_name").clear271 @driver.find_element(:name, "cc_frst_name").send_keys "Selenium"272 @driver.find_element(:name, "cc_last_name").clear273 @driver.find_element(:name, "cc_last_name").send_keys "User"274 @driver.find_element(:name, "ticketLess").click275 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Delivery Address'])[1]/following::input[1]").click276 @driver.find_element(:name, "buyFlights").click277end278279def Navigate_Site_4280 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='CONTACT'])[1]/following::img[3]").click281 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Vacations'])[1]/following::u[1]").click282 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Vacations'])[1]/following::u[1]").click283 @driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Use Java Version'])[1]/following::img[1]").click ...

Full Screen

Full Screen

Ch_8_Prog_4_Long_Linear_Ruby_Program.rb

Source:Ch_8_Prog_4_Long_Linear_Ruby_Program.rb Github

copy

Full Screen

...78@driver.find_element(:name, "login").click79@driver.find_element(:link, "Flights").click80#@driver.find_element(:name, "toDay").click81#@driver.find_element(:name, "toDay").click82Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "toDay")).select_by(:text, "15")83@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Returning:'])[1]/following::option[27]").click84@driver.find_element(:name, "findFlights").click85@driver.find_element(:name, "reserveFlights").click86@driver.find_element(:name, "passFirst0").click87@driver.find_element(:name, "passFirst0").clear88@driver.find_element(:name, "passFirst0").send_keys "Selenium"89@driver.find_element(:name, "passLast0").clear90@driver.find_element(:name, "passLast0").send_keys "User"91Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Bland")92Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Diabetic")93Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Hindu")94Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Kosher")95Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Low Calorie")96@driver.find_element(:name, "creditnumber").clear97@driver.find_element(:name, "creditnumber").send_keys "1234567890123456"98Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_mn")).select_by(:text, "01")99Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_mn")).select_by(:text, "02")100Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_mn")).select_by(:text, "03")101Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2000")102Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2001")103Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2002")104Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2003")105(close_alert_and_get_its_text()).should == "You have entered 2003 as expiration year!"106@driver.find_element(:name, "cc_exp_dt_yr").click107Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2010")108@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Expiration:'])[1]/following::option[31]").click109@driver.find_element(:name, "cc_frst_name").click110@driver.find_element(:name, "cc_frst_name").clear111@driver.find_element(:name, "cc_frst_name").send_keys "Selenium"112@driver.find_element(:name, "cc_last_name").clear113@driver.find_element(:name, "cc_last_name").send_keys "User"114@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='CONTACT'])[1]/following::table[3]").click115@driver.find_element(:name, "ticketLess").click116@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")117118@driver.find_element(:name, "buyFlights").click119@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")120121@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='CONTACT'])[1]/following::img[3]").click122@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='$584 USD'])[1]/following::img[3]").click123@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Flights'])[1]/following::td[2]").click124@driver.find_element(:link, "Hotels").click125@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='© 2005, Mercury Interactive (v. 011003-1.01-058)'])[1]/preceding::img[1]").click126@driver.find_element(:link, "Car Rentals").click127@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='© 2005, Mercury Interactive (v. 011003-1.01-058)'])[1]/preceding::img[1]").click128@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Shipboard accomodations include: all meals, daily activities and nightly entertainment'])[1]/following::img[1]").click129@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::font[3]").click130@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::font[3]").click131@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='CONTACT'])[1]/following::table[3]").click132@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::font[3]").click133@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")134135@driver.find_element(:name, "findFlights").click136@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")137138@driver.find_element(:name, "reserveFlights").click139@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Cruises'])[1]/following::td[2]").click140@driver.find_element(:link, "Cruises").click141@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='© 2005, Mercury Interactive (v. 011003-1.01-058)'])[1]/preceding::img[1]").click142@driver.find_element(:link, "Cruises").click143@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")144145@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Shipboard accomodations include: all meals, daily activities and nightly entertainment'])[1]/following::img[1]").click146@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::font[3]").click147@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::font[3]").click148@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Preferences'])[1]/following::td[2]").click149@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Airline:'])[1]/preceding::input[1]").click150@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Airline:'])[1]/preceding::input[2]").click151@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Airline:'])[1]/preceding::input[1]").click152@driver.find_element(:name, "passCount").click153Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "passCount")).select_by(:text, "4")154@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")155156@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Passengers:'])[1]/following::option[4]").click157@driver.find_element(:name, "toDay").click158Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "toDay")).select_by(:text, "19")159@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Returning:'])[1]/following::option[31]").click160@driver.find_element(:name, "fromPort").click161Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "fromPort")).select_by(:text, "New York")162@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Passengers:'])[1]/following::option[8]").click163@driver.find_element(:name, "toPort").click164Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "toPort")).select_by(:text, "Sydney")165@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='On:'])[1]/following::option[52]").click166@driver.find_element(:name, "findFlights").click167@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")168169@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 363'])[1]/preceding::td[1]").click170@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 363'])[1]/preceding::td[1]").click171@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 363'])[1]/preceding::td[1]").click172@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 363'])[1]/preceding::input[1]").click173@driver.find_element(:name, "results").click174@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")175176@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 633'])[1]/preceding::td[1]").click177@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 633'])[1]/preceding::td[1]").click178@driver.find_element(:xpath, "//td").click179@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Unified Airlines 633'])[1]/preceding::input[1]").click180@driver.find_element(:name, "reserveFlights").click181@driver.find_element(:name, "passFirst0").click182@driver.find_element(:name, "passFirst0").clear183@driver.find_element(:name, "passFirst0").send_keys "Selenium"184@driver.find_element(:name, "passLast0").clear185@driver.find_element(:name, "passLast0").send_keys "User"186@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")187188Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Bland")189Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Diabetic")190Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.0.meal")).select_by(:text, "Bland")191@driver.find_element(:name, "passFirst1").clear192@driver.find_element(:name, "passFirst1").send_keys "Sel"193@driver.find_element(:name, "passLast1").clear194@driver.find_element(:name, "passLast1").send_keys "U2"195@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")196197Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.1.meal")).select_by(:text, "Bland")198@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Last Name:'])[2]/following::td[1]").click199Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.1.meal")).select_by(:text, "Diabetic")200@driver.find_element(:name, "passFirst2").clear201@driver.find_element(:name, "passFirst2").send_keys "Sel"202@driver.find_element(:name, "passLast2").clear203@driver.find_element(:name, "passLast2").send_keys "U3"204Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Bland")205Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Diabetic")206Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Hindu")207@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")208209@driver.find_element(:name, "passFirst3").clear210@driver.find_element(:name, "passFirst3").send_keys "Sel"211@driver.find_element(:name, "passLast3").clear212@driver.find_element(:name, "passLast3").send_keys "U4"213Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.3.meal")).select_by(:text, "Bland")214Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.3.meal")).select_by(:text, "Diabetic")215Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.3.meal")).select_by(:text, "Hindu")216Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.3.meal")).select_by(:text, "Kosher")217Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.3.meal")).select_by(:text, "Low Calorie")218Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Kosher")219Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Low Calorie")220Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "pass.2.meal")).select_by(:text, "Low Cholesterol")221@driver.find_element(:name, "creditnumber").clear222@driver.find_element(:name, "creditnumber").send_keys "123"223@driver.find_element(:name, "creditnumber").send_keys :down224@driver.find_element(:name, "creditnumber").send_keys :down225@driver.find_element(:name, "creditnumber").send_keys :down226@driver.find_element(:name, "creditnumber").send_keys :tab227@driver.save_screenshot("./#{Time.now.strftime("failshot__%d_%m_%Y__%H_%M_%S")}.png")228229Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_mn")).select_by(:text, "01")230Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2000")231Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2001")232Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2002")233Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2003")234(close_alert_and_get_its_text()).should == "You have entered 2003 as expiration year!"235Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2004")236Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2005")237Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2006")238Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2007")239Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2008")240Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2009")241Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "cc_exp_dt_yr")).select_by(:text, "2010")242@driver.find_element(:name, "cc_frst_name").clear243@driver.find_element(:name, "cc_frst_name").send_keys "Selenium"244@driver.find_element(:name, "cc_last_name").clear245@driver.find_element(:name, "cc_last_name").send_keys "User"246@driver.find_element(:name, "ticketLess").click247@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Delivery Address'])[1]/following::input[1]").click248@driver.find_element(:name, "buyFlights").click249@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='CONTACT'])[1]/following::img[3]").click250@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Vacations'])[1]/following::u[1]").click251@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Vacations'])[1]/following::u[1]").click252@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Use Java Version'])[1]/following::img[1]").click253@driver.find_element(:link, "SUPPORT").click254@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='CONTACT'])[1]/following::td[7]").click255@driver.find_element(:xpath, "(.//*[normalize-space(text()) and normalize-space(.)='Cruises'])[1]/following::td[2]").click ...

Full Screen

Full Screen

Sols_Project_spec.rb

Source:Sols_Project_spec.rb Github

copy

Full Screen

...26 @driver.find_element(:name, "reseller_info[reseller_business_phone]").clear27 @driver.find_element(:name, "reseller_info[reseller_business_phone]").send_keys "9735575158"28 sleep(4)29 @driver.find_element(:id, "default-0").click30 Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, "country-0")).select_by(:text, "United States")31 @driver.find_element(:css, "option[value=\"US\"]").click32 @driver.find_element(:name, "address[0][street_1]").clear33 @driver.find_element(:name, "address[0][street_1]").send_keys "17 qa testing"34 @driver.find_element(:name, "address[0][city]").clear35 @driver.find_element(:name, "address[0][city]").send_keys "Sols city"36 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "address[0][state]")).select_by(:text, "New Jersey")37 @driver.find_element(:css, "option[value=\"NJ\"]").click38 @driver.find_element(:id, "postal-0").clear39 @driver.find_element(:id, "postal-0").send_keys "07522"40 sleep(2)41 @driver.find_element(:css, "span.repeater").click42 Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, "country-1")).select_by(:text, "United States")43 @driver.find_element(:css, "#country-1 > option[value=\"US\"]").click44 @driver.find_element(:name, "address[1][street_1]").clear45 @driver.find_element(:name, "address[1][street_1]").send_keys "17 qa testing 2"46 @driver.find_element(:name, "address[1][city]").clear47 @driver.find_element(:name, "address[1][city]").send_keys "Sols city 2"48 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "address[1][state]")).select_by(:text, "New Jersey")49 @driver.find_element(:css, "select[name=\"address[1][state]\"] > option[value=\"NJ\"]").click50 @driver.find_element(:id, "postal-1").clear51 @driver.find_element(:id, "postal-1").send_keys "07512"52 sleep(2)53puts 'Practice Page'54 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "reseller_info[describe_as]")).select_by(:text, "Physical Therapist")55 @driver.find_element(:css, "option[value=\"4\"]").click56 @driver.find_element(:name, "reseller_info[school]").clear57 @driver.find_element(:name, "reseller_info[school]").send_keys "NJit testing"58 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "reseller_info[graduation_date][month]")).select_by(:text, "June")59 @driver.find_element(:css, "select[name=\"reseller_info[graduation_date][month]\"] > option[value=\"6\"]").click60 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "reseller_info[graduation_date][year]")).select_by(:text, "2007")61 @driver.find_element(:css, "option[value=\"2007\"]").click62 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "reseller_info[number_of_patients]")).select_by(:text, "31+")63 @driver.find_element(:css, "option[value=\"31+\"]").click64 @driver.find_element(:id, "contract-file-upload").send_keys "/Users/golamhassan/Desktop/Screen_Shot.png"65 #@driver.find_element(:id, "contract-file-upload").click66 #@driver.find_element(:id, "html5_19nafdseq1v8i1vi1fne15rrg4i3").clear67 # @driver.find_element(:id, "html5_19nafdseq1v8i1vi1fne15rrg4i3").send_keys "/Users/golamhassan/Desktop/Screen_Shot.png"68 sleep(2)69 @driver.find_element(:xpath, "//button[@value='continue']").click70 sleep(2)71puts 'Providers Page'72 @driver.find_element(:name, "practice[practice_name]").clear73 @driver.find_element(:name, "practice[practice_name]").send_keys "qa368 sols inc"74 @driver.find_element(:name, "practice[website]").clear75 @driver.find_element(:name, "practice[website]").send_keys "www.qa368sols.com"76 Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, "provider-type")).select_by(:text, "Partnership")77 @driver.find_element(:css, "option[value=\"3\"]").click78 Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, "provider-range")).select_by(:text, "11-20")79 @driver.find_element(:css, "option[value=\"11-20\"]").click80 sleep(2)81 @driver.find_element(:id, "tax-1").clear82 @driver.find_element(:id, "tax-1").send_keys "12"83 @driver.find_element(:id, "tax-2").clear84 @driver.find_element(:id, "tax-2").send_keys "1232110"85 @driver.find_element(:css, "button.step-action").click86sleep(2)87puts 'Package Page'88 @driver.find_element(:css, "span.repeater").click89 @driver.find_element(:name, "invite[0][first_name]").clear90 @driver.find_element(:name, "invite[0][first_name]").send_keys "qa368ap"91 @driver.find_element(:name, "invite[0][last_name]").clear92 @driver.find_element(:name, "invite[0][last_name]").send_keys "solsap"...

Full Screen

Full Screen

test.rb

Source:test.rb Github

copy

Full Screen

...26 def do_login27 @driver.get(@base_url + "/")28 @driver.find_element(:css, 'input[type="password"]').send_keys SHARED_PASSWORD29 @driver.find_element(:xpath, "//input[@value='GO']").click30 Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, "initials")).select_by(:value, "-1")31 Selenium::WebDriver::Support::Select.new(@driver.find_element(:id, "user-names")).select_by(:value, "1")32 @driver.find_element(:css, 'input[type="password"]').send_keys SHARED_PASSWORD33 @driver.find_element(:xpath, "//input[@value='GO']").click34 @wait.until { @driver.find_element(:css, ".top-message") }35 end36 it "test_login" do37 do_login38 expect(element_present?(:css, ".top-message")).to be(true)39 @wait.until { @driver.find_element(:css, ".login-message").displayed? }40 end41 it "test_admin_useradd" do42 do_login43 @driver.get(@base_url + "/admin")44 @driver.find_element(:id, "add-user").click45 @driver.find_element(:name, "name").send_keys "綾瀬 千早"46 @driver.find_element(:name, "furigana").send_keys "あやせ ちはや"47 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "attr_2")).select_by(:text, "女")48 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "attr_3")).select_by(:text, "2年")49 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "attr_4")).select_by(:text, "A級")50 Selenium::WebDriver::Support::Select.new(@driver.find_element(:name, "attr_5")).select_by(:text, "4")51 @driver.find_element(:xpath, "(//input[@name='name'])[2]").send_keys "真島 太一"52 @driver.find_element(:xpath, "(//input[@name='furigana'])[2]").send_keys "ましま たいち"53 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_3'])[2]")).select_by(:text, "2年")54 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_4'])[2]")).select_by(:text, "B級")55 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_5'])[2]")).select_by(:text, "2")56 @driver.find_element(:xpath, "(//input[@name='name'])[3]").send_keys "西田 優征"57 @driver.find_element(:xpath, "(//input[@name='furigana'])[3]").send_keys "にしだ ゆうせい"58 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_3'])[3]")).select_by(:text, "2年")59 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_4'])[3]")).select_by(:text, "B級")60 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_5'])[3]")).select_by(:text, "2")61 @driver.find_element(:xpath, "(//input[@name='name'])[4]").send_keys "駒野 勉"62 @driver.find_element(:xpath, "(//input[@name='furigana'])[4]").send_keys "こまの つとむ"63 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_4'])[4]")).select_by(:text, "D級")64 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_3'])[4]")).select_by(:text, "2年")65 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_3'])[4]")).select_by(:text, "3年")66 @driver.find_element(:xpath, "(//input[@name='name'])[5]").send_keys "大江 奏"67 @driver.find_element(:xpath, "(//input[@name='furigana'])[5]").send_keys "おおえ かなで"68 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_2'])[5]")).select_by(:text, "女")69 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_3'])[5]")).select_by(:text, "3年")70 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_4'])[5]")).select_by(:text, "C級")71 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_5'])[5]")).select_by(:text, "1")72 @driver.find_element(:xpath, "(//input[@name='name'])[6]").send_keys "筑波 秋博"73 @driver.find_element(:xpath, "(//input[@name='furigana'])[6]").send_keys "つくば あきひろ"74 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_4'])[6]")).select_by(:text, "D級")75 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_6'])[6]")).select_by(:text, "×")76 @driver.find_element(:xpath, "(//input[@name='name'])[7]").send_keys "花野 菫"77 @driver.find_element(:xpath, "(//input[@name='furigana'])[7]").send_keys "はなの すみれ"78 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_2'])[7]")).select_by(:text, "女")79 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_4'])[7]")).select_by(:text, "C級")80 Selenium::WebDriver::Support::Select.new(@driver.find_element(:xpath, "(//select[@name='attr_5'])[7]")).select_by(:text, "1")81 @driver.find_element(:id, "apply-add").click82 expect(element_present?(:xpath, "//div[@class='cb-container']/div[text()='追加完了']")).to be(true)83 end84 85 def element_present?(how, what)86 @driver.find_element(how, what)87 true88 rescue Selenium::WebDriver::Error::NoSuchElementError89 false90 end91 92 def alert_present?()93 @driver.switch_to.alert94 true...

Full Screen

Full Screen

thomascook_com_v2.rb

Source:thomascook_com_v2.rb Github

copy

Full Screen

...116begin117 url = driver.current_url118 #sleep 1119 #driver.find_element(:id => "title").click120 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "title")).select_by :text, "Mr"121 driver.find_element(:id, "name").send_keys "Luke"122 driver.find_element(:id, "surname").send_keys "Skywalker"123 driver.find_element(:id, "email").send_keys "jediknight@gmail.com"124 driver.find_element(:id, "leadPassengerConfirmEmail").send_keys "jediknight@gmail.com"125 Postcode = driver.find_element(:id, "postCode")126 Postcode.location_once_scrolled_into_view127 Postcode.send_keys "E7 9AL"128 driver.find_element(:xpath, "//a[@class='btn btn-default get-address']").click129 sleep 5130 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "addressSelect")).select_by :text, "1 EARLHAM GROVE"131 City = driver.find_element(:id, "city")132 City.location_once_scrolled_into_view133 unless City.attribute('value').include? "LONDON"134 fail "City box does not contain LONDON"135 end136 CountryDropdown = driver.find_element(:id, "country")137 CountryDropdown.location_once_scrolled_into_view138 Option = CountryDropdown.find_element(tag_name: "option")139 unless Option.attribute('value').include? "UK"140 fail "Country box does not contain United Kingdom"141 end142 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "day")).select_by :text, "13"143 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "month")).select_by :text, "June"144 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "year")).select_by :text, "1990"145 driver.find_element(:id, "contactNumber").send_keys "020 7219 4272"146 driver.find_element(:xpath, "//a[@class='btn btn-success noArrow pax-confirm']").click147 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "title2Room1")).select_by :text, "Mrs"148 driver.find_element(:id, "name2Room1").send_keys "Mara"149 driver.find_element(:id, "surname2Room1").send_keys "Skywalker"150 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "day2Room1")).select_by :text, "25"151 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "month2Room1")).select_by :text, "April"152 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "year2Room1")).select_by :text, "1992"153 driver.find_element(:id, "paxSubmit").click154rescue => exception155 retry_count -= 1156 if retry_count > 0157 driver.navigate.refresh158 retry159 else160 retval = 5161 puts exception.backtrace162 puts "Died on #{url}"163 screenfile = "Fail_#{Time.now.strftime("%d.%m.%Y__%H'%M'%S")}.jpg"164 teardown(driver,screenfile,retval)165 end166ensure...

Full Screen

Full Screen

thomascook_nl.rb

Source:thomascook_nl.rb Github

copy

Full Screen

...93end94# Fill the passenger details95begin96 url = driver.current_url97 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "title_0")).select_by :text, "de heer"98 driver.find_element(:id, "firstName_0").send_keys "Luke"99 driver.find_element(:id, "lastName_0").send_keys "Skywalker"100 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "passengerFormBean.passengerListForm0.dayOB")).select_by :text, "13"101 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "passengerFormBean.passengerListForm0.monthOB")).select_by :text, "Juni"102 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "passengerFormBean.passengerListForm0.yearOB")).select_by :text, "1990"103 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "title_1")).select_by :text, "Mevrouw"104 driver.find_element(:id, "firstName_1").send_keys "Mara"105 driver.find_element(:id, "lastName_1").send_keys "Skywalker"106 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "passengerFormBean.passengerListForm1.dayOB")).select_by :text, "25"107 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "passengerFormBean.passengerListForm1.monthOB")).select_by :text, "Apr"108 Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "passengerFormBean.passengerListForm1.yearOB")).select_by :text, "1992"109 driver.find_element(:id, "streetAddress").send_keys "Rokin"110 driver.find_element(:id, "houseNumber").send_keys "1"111 driver.find_element(:id, "postcode").send_keys "NL-1000"112 driver.find_element(:id, "townCity").send_keys "Amsterdam"113 driver.find_element(:id, "contactNumber").send_keys "+31 30 2357822"114 driver.find_element(:id, "email").send_keys "luke.skywalker@gmail.com"115 driver.find_element(:id, "confirmEmail").send_keys "luke.skywalker@gmail.com"116 driver.find_element(:id, "emergencyName").send_keys "Obiwan"117 driver.find_element(:id, "emergencyTelephone").send_keys "+31 30 2357822"118 driver.find_element(:xpath, "//input[@class='btn']").click119rescue => exception120 retry_count -= 1121 if retry_count > 0122 driver.navigate.refresh...

Full Screen

Full Screen

flight_page.rb

Source:flight_page.rb Github

copy

Full Screen

...10 driver.find_elements(:name => "tripType").each { |elem| elem.click && break if elem.attribute("value") == trip_type && elem.attribute("type") == "radio" }11 end1213 def select_depart_from(from_port)14 Selenium::WebDriver::Support::Select.new(driver.find_element(:name, "fromPort")).select_by(:text, from_port)15 end1617 def select_arrive_at(to_port)18 Selenium::WebDriver::Support::Select.new(driver.find_element(:name, "toPort")).select_by(:text, to_port)19 end2021 def select_depart_day(depart_day)22 Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "departDay")).select_by(:text, depart_day)23 end2425 def select_depart_month(depart_month)26 Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "departMonth")).select_by(:text, depart_month)27 end2829 def select_return_day(return_day)30 Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "returnDay")).select_by(:text, return_day)31 end3233 def select_return_month(return_month)34 Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "returnMonth")).select_by(:text, return_month)35 end3637 def click_continue38 driver.find_element(:xpath,"//input[@value='Continue']").click39 end4041end ...

Full Screen

Full Screen

lesson.rb

Source:lesson.rb Github

copy

Full Screen

2 require "selenium-webdriver"3 driver = Selenium::WebDriver.for :chrome4 driver.navigate.to "https://j29-asw.osaka-sandai.ac.jp/uniasv2/UnSSOLoginControlFree"5 select1 = Selenium::WebDriver::Support::Select.new(driver.find_element(:name, 'selLsnOpcFcy'))6 select1.select_by(:value, '2020')7 select2 = Selenium::WebDriver::Support::Select.new(driver.find_element(:name, 'selEsorNm'))8 select2.select_by(:value, '2')9 select2 = Selenium::WebDriver::Support::Select.new(driver.find_element(:name, 'selSlbaflNm'))10 select2.select_by(:value, '53 02 00')11 unless driver.find_element(:id, 'chkPlrlSpcflnp_01_1').selected?12 driver.find_element(:id, 'chkPlrlSpcflnp_01_1').click13 end14 15 driver.find_element(:name, 'ESearch').click16 wait = Selenium::WebDriver::Wait.new(timeout: 10)17 wait.until { driver.find_element(:id, 'contents').displayed? }18 rows1 = driver.find_elements(:xpath, "//div[@class='tablearea']/div[@class='scrl']//tr")19 rows = rows1.map {|row1| row1.text.split }20 genre = ["visual","introspective","language","music","interpersonal","physical","museum","pirituality","logical"]21 num = 022 rows.each do |row|23 search = Lesson.new24 search.genre = genre.sample...

Full Screen

Full Screen

select_by

Using AI Code Generation

copy

Full Screen

1element = driver.find_element(:name, 'q')2Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "mySelect")).select_by(:text, "Option 1")3Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "mySelect")).select_by(:value, "option1")4Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "mySelect")).select_by(:index, 1)5element = driver.find_element(:name, 'q')6Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "mySelect")).select_by(:text, "Option 1")7Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "mySelect")).select_by(:value, "option1")8Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "mySelect")).select_by(:index, 1)9element = driver.find_element(:name, 'q')10Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "mySelect")).select_by(:text, "Option 1")11Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "mySelect")).select_by(:value, "option1")12Selenium::WebDriver::Support::Select.new(driver.find_element(:id, "mySelect")).select_by(:index, 1)

Full Screen

Full Screen

select_by

Using AI Code Generation

copy

Full Screen

1driver.find_element(:name, 'q').send_keys "Selenium WebDriver"2driver.find_element(:name, 'btnG').click3driver.find_element(:link_text, 'Selenium - Web Browser Automation').click4wait.until { driver.find_element(:tag_name => "body") }5select = Selenium::WebDriver::Support::Select.new(driver.find_element(:id => "lang-chooser"))6select.select_by(:text, "Ruby")

Full Screen

Full Screen

select_by

Using AI Code Generation

copy

Full Screen

1driver.find_element(:name, "q").send_keys "selenium"2driver.find_element(:name, "btnG").click3driver.find_element(:link_text, "Selenium - Web Browser Automation").click4driver.find_element(:link_text, "Download").click5driver.find_element(:link_text, "Download").click6driver.find_element(:id, "menu_download").click7driver.find_element(:link_text, "Download").click8driver.find_element(:link_text, "Download").click9driver.find_element(:id, "menu_download").click10driver.find_element(:id, "menu_download").click11driver.find_element(:link_text, "Download").click12driver.find_element(:id, "menu_download").click13driver.find_element(:link_text, "Download").click14driver.find_element(:id, "menu_download").click15driver.find_element(:link_text, "Download").click16driver.find_element(:link_text, "Download").click17driver.find_element(:id, "menu_download").click18driver.find_element(:link_text, "Download").click19driver.find_element(:id, "menu_download").click20driver.find_element(:link_text, "Download").click21driver.find_element(:link_text, "Download").click22driver.find_element(:id, "menu_download").click23driver.find_element(:link_text, "Download").click24driver.find_element(:id, "menu_download").click25driver.find_element(:link_text, "Download").click26driver.find_element(:link_text, "Download").click27driver.find_element(:id, "menu_download").click28driver.find_element(:id, "menu_download").click29driver.find_element(:link_text, "Download").click30driver.find_element(:id, "menu_download").click31driver.find_element(:link_text, "Download").click32driver.find_element(:id, "menu_download").click33driver.find_element(:link_text, "Download").click34driver.find_element(:id, "menu_download").click35driver.find_element(:link_text, "Download").click36driver.find_element(:link_text, "Download").click37driver.find_element(:id, "menu_download").click

Full Screen

Full Screen

select_by

Using AI Code Generation

copy

Full Screen

1dropdown = driver.find_element(:id, 'lst-ib')2dropdown = driver.find_element(:css, 'input.gLFyf.gsfi')3dropdown = driver.find_element(:xpath, '//input[@class="gLFyf gsfi"]')4dropdown = driver.find_element(:name, 'q')5dropdown = driver.find_element(:class, 'gLFyf gsfi')6dropdown = driver.find_element(:link, 'Gmail')7dropdown = driver.find_element(:partial_link, 'Gmail')8dropdown = driver.find_element(:tag_name, 'input')9dropdown = driver.find_element(:link_text, 'Gmail')10dropdown = driver.find_element(:partial_link_text, 'Gmail')11dropdown = driver.find_element(:class_name, 'gLFyf gsfi')

Full Screen

Full Screen

select_by

Using AI Code Generation

copy

Full Screen

1element = driver.find_element(:id, "lst-ib")2button = driver.find_element(:name, "btnG")3link = driver.find_element(:link, "Selenium - Web Browser Automation")4drop_down_list = driver.find_element(:id, "selenium_commands")5Selenium::WebDriver::Support::Select.new(drop_down_list).select_by(:text, "Switch Commands")

Full Screen

Full Screen

select_by

Using AI Code Generation

copy

Full Screen

1month_dd = driver.find_element(:id, "month")2month_options = month_dd.find_elements(:tag_name, "option")3day_dd = driver.find_element(:id, "day")4day_options = day_dd.find_elements(:tag_name, "option")5year_dd = driver.find_element(:id, "year")6year_options = year_dd.find_elements(:tag_name, "option")7month_dd = driver.find_element(:id, "month")8month_options = month_dd.find_elements(:tag_name, "option")9Selenium::WebDriver::Support::Select.new(month_dd).select_by(:text, "Feb")10day_dd = driver.find_element(:id, "day")11day_options = day_dd.find_elements(:tag_name, "option")12Selenium::WebDriver::Support::Select.new(day_dd).select_by(:text, "24")13year_dd = driver.find_element(:id, "year")14year_options = year_dd.find_elements(:tag_name, "option")15Selenium::WebDriver::Support::Select.new(year_dd).select_by(:text, "1986")16month_dd = driver.find_element(:id, "month")17month_options = month_dd.find_elements(:

Full Screen

Full Screen

select_by

Using AI Code Generation

copy

Full Screen

1search_field = driver.find_element(:name, "q")2wait = Selenium::WebDriver::Wait.new(:timeout => 10)3wait.until { driver.title.downcase.start_with? "selenium-webdriver" }4driver.find_element(:css, "h3.r a").click5wait.until { driver.title.downcase.start_with? "selenium webdriver" }6wait.until { driver.title.downcase.start_with? "selenium webdriver" }

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful