How to use click method of Selenium.WebDriver Package

Best Selenium code snippet using Selenium.WebDriver.click

Class - Jobs Resource.rb

Source:Class - Jobs Resource.rb Github

copy

Full Screen

...143 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}144 end145 wait_for {@driver.find_element(JOBS_OPTN).displayed?}146 jobs_button = @driver.find_element(JOBS_OPTN)147 jobs_button.click148 def wait_for2()149 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}150 end151 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }152 end153 def create_job()154 def wait_for()155 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}156 end157 wait_for {@driver.find_element(CREATE_JOB_BTN).displayed?}158 create_job_button = @driver.find_element(CREATE_JOB_BTN)159 create_job_button.click160 sleep(3)161 @driver.switch_to.frame(0)162 end163 def select_customer(selectcustomer)164 select_customer = @driver.find_element(CUSTOMER_SEARCH_FIELD)165 select_customer.send_keys(selectcustomer)166 sleep(2)167 @driver.action.send_keys(:enter).perform168 sleep(2)169 select_customer_next = @driver.find_element(CUSTOMER_NEXT_BTN)170 select_customer_next.click171 sleep(2)172 @driver.switch_to.frame(0)173 end174 def top()175 top_record = @driver.find_element(TOP_JOB)176 end177 def top_refnumber()178 top_refnumber = @driver.find_element(TOP_REFNUMBER)179 end180 def top_status()181 top_refnumber = @driver.find_element(TOP_STATUS)182 end183 def top_type()184 top_refnumber = @driver.find_element(TOP_TYPE)185 end186 def top_open()187 def wait_for()188 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}189 end190 wait_for {@driver.find_element(TOP_REFNUMBER).displayed?}191 top_refnumber = @driver.find_element(TOP_REFNUMBER)192 top_refnumber.click193 sleep(2)194 @driver.switch_to.frame(0)195 end196 def top_actions()197 def wait_for()198 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}199 end200 wait_for {@driver.find_element(TOP_JOB_ACTIONS).displayed?}201 top_actions = @driver.find_element(TOP_JOB_ACTIONS)202 top_actions.click203 end204 def actions_viewjob()205 #Only accessible in grid actions206 def wait_for()207 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}208 end209 wait_for {@driver.find_element(ACTIONS_VIEWJOB).displayed?}210 top_view = @driver.find_element(ACTIONS_VIEWJOB)211 top_view.click212 sleep(2)213 @driver.switch_to.frame(0)214 end215 def actions_createactivity()216 def wait_for()217 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}218 end219 wait_for {@driver.find_element(ACTIONS_CREATEACTIVITY).displayed?}220 top_createactivity = @driver.find_element(ACTIONS_CREATEACTIVITY)221 top_createactivity.click222 sleep(2)223 @driver.switch_to.frame(0)224 end225 def actions_createinvoice()226 def wait_for()227 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}228 end229 wait_for {@driver.find_element(ACTIONS_CREATEINVOICE).displayed?}230 top_createinvoice = @driver.find_element(ACTIONS_CREATEINVOICE)231 top_createinvoice.click232 sleep(2)233 @driver.switch_to.frame(0)234 end235 def actions_documents()236 def wait_for()237 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}238 end239 wait_for {@driver.find_element(ACTIONS_DOCUMENTS).displayed?}240 top_documents = @driver.find_element(ACTIONS_DOCUMENTS)241 top_documents.click242 sleep(2)243 @driver.switch_to.frame(0)244 end245 def actions_printemail()246 def wait_for()247 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}248 end249 wait_for {@driver.find_element(ACTIONS_PRINTEMAIL).displayed?}250 top_printemail = @driver.find_element(ACTIONS_PRINTEMAIL)251 top_printemail.click252 sleep(2)253 @driver.switch_to.frame(0)254 end255 def actions_duplicatejob()256 def wait_for()257 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}258 end259 wait_for {@driver.find_element(ACTIONS_DUPLICATEJOB).displayed?}260 top_duplicate = @driver.find_element(ACTIONS_DUPLICATEJOB)261 top_duplicate.click262 sleep(2)263 @driver.switch_to.frame(0)264 end265 def actions_makeinactive()266 def wait_for()267 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}268 end269 wait_for {@driver.find_element(ACTIONS_MAKEINACTIVE).displayed?}270 top_makeinactive = @driver.find_element(ACTIONS_MAKEINACTIVE)271 top_makeinactive.click272 end273 def search_job(searchname)274 def wait_for()275 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}276 end277 wait_for {@driver.find_element(SEARCH_FIELD).displayed?}278 job_search = @driver.find_element(SEARCH_FIELD)279 job_search.send_keys(searchname)280 def wait_for2()281 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}282 end283 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}284 search_confirm = @driver.find_element(SEARCH_BTN)285 search_confirm.click286 sleep(2)287 end288 def search_jobid(searchname)289 def wait_for()290 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}291 end292 wait_for {@driver.find_element(ID_COLUMN).displayed?}293 job_search = @driver.find_element(ID_COLUMN)294 job_search.send_keys(searchname)295 sleep(3)296 end297 def search_jobname(searchname)298 def wait_for()299 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}300 end301 wait_for {@driver.find_element(NAME_COLUMN).displayed?}302 job_search = @driver.find_element(NAME_COLUMN)303 job_search.send_keys(searchname)304 sleep(3)305 end306 def search_reset()307 def wait_for()308 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}309 end310 wait_for {@driver.find_element(RESET_BTN).displayed?}311 search_reset = @driver.find_element(RESET_BTN)312 search_reset.click313 end314 def grid_options()315 def wait_for()316 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}317 end318 wait_for {@driver.find_element(GRID_OPTIONS_DROPDOWN).displayed?}319 grid_options = @driver.find_element(GRID_OPTIONS_DROPDOWN)320 grid_options.click321 end322 def export_jobs()323 def wait_for()324 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}325 end326 wait_for {@driver.find_element(EXPORT_JOBS).displayed?}327 export_jobs = @driver.find_element(EXPORT_JOBS)328 export_jobs.click329 end330 def show_inactives()331 def wait_for()332 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}333 end334 wait_for {@driver.find_element(SHOW_INACTIVES).displayed?}335 show_inactives = @driver.find_element(SHOW_INACTIVES)336 show_inactives.click337 end338 def grid_total()339 gridtotal = @driver.find_element(GRID_TOTAL)340 end341 def resource_performance()342 navigationStart = driver.execute_script("return window.performance.timing.navigationStart")343 responseStart = driver.execute_script("return window.performance.timing.responseStart")344 domComplete = driver.execute_script("return window.performance.timing.domComplete")345 loadPerformance = domComplete - navigationStart346 def wait_for347 Selenium::WebDriver::Wait.new(:timeout => 20).until { yield }348 end349 wait_for {driver.find_element(GRID_TOTAL).text != "0 records" }350 jobs_records = driver.find_element(GRID_TOTAL)351 jobs_count = jobs_records.text352 print "Jobs: \n"353 print "%s \n" % jobs_count354 print "Load Time: %s ms \n\n" % loadPerformance355 end356 #CSS Methods: Popup357 def name(jobname)358 job_name = @driver.find_element(NAME_FIELD)359 job_name.send_keys(jobname)360 end361 def location(locationselect)362 dropdown_list = @driver.find_element(LOCATION_DROPDOWN)363 options = dropdown_list.find_elements(tag_name: 'option')364 options.each {|option| option.click if option.text == (locationselect)}365 end366 def type(typeselect)367 dropdown_list = @driver.find_element(TYPE_DROPDOWN)368 options = dropdown_list.find_elements(tag_name: 'option')369 options.each {|option| option.click if option.text == (typeselect)}370 end371 def customer(customername)372 customer_name = @driver.find_element(CUSTOMER_FIELD)373 customer_name.send_keys(customername)374 end375 def patrol(patrolname)376 patrol_name = @driver.find_element(PATROL_FIELD)377 patrol_name.send_keys(patrolname)378 end379 def estimate(estimatename)380 estimate_name = @driver.find_element(ESTIMATE_FIELD)381 estimate_name.send_keys(estimatename)382 end383 def po_number(ponumber)384 po_number = @driver.find_element(PONUMBER_FIELD)385 po_number.send_keys(ponumber)386 end387 def account_executive(accountexecutive)388 dropdown_list = @driver.find_element(ACCOUNT_EXECUTIVE_DROPDOWN)389 options = dropdown_list.find_elements(tag_name: 'option')390 options.each {|option| option.click if option.text == (accountexecutive)}391 end392 def nte(ntefield)393 po_number = @driver.find_element(NTE_FIELD)394 po_number.send_keys(ntefield)395 end396 def cancel()397 def wait_for()398 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}399 end400 wait_for {@driver.find_element(CANCEL_BTN).displayed?}401 cancel_popup = @driver.find_element(CANCEL_BTN)402 cancel_popup.click403 end404 def actions()405 #Use actions_(action) methods from here406 def wait_for()407 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}408 end409 wait_for {@driver.find_element(ACTIONS_BTN).displayed?}410 actions_popup = @driver.find_element(ACTIONS_BTN)411 actions_popup.click412 end413 def save()414 def wait_for()415 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}416 end417 wait_for {@driver.find_element(SAVE_BTN).displayed?}418 save = @driver.find_element(SAVE_BTN)419 save.click420 end421 def save_close()422 def wait_for()423 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}424 end425 wait_for {@driver.find_element(SAVE_AND_CLOSE_BTN).displayed?}426 save_and_close = @driver.find_element(SAVE_AND_CLOSE_BTN)427 save_and_close.click428 sleep(2)429 end430 #CSS Methods: Popup (Lines)431 def lines_tab()432 def wait_for()433 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}434 end435 wait_for {@driver.find_element(LINES_TAB).displayed?}436 lines_tab = @driver.find_element(LINES_TAB)437 lines_tab.click438 end439 def line1_service_date(servicedate1)440 def wait_for()441 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}442 end443 wait_for {@driver.find_element(LINE1_SERVICE_DATE_SPAN).displayed?}444 span_field = @driver.find_element(LINE1_SERVICE_DATE_SPAN)445 span_field.click446 def wait_for2()447 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}448 end449 wait_for2 {@driver.find_element(LINE1_SERVICE_DATE).displayed?}450 servicedate_field = @driver.find_element(LINE1_SERVICE_DATE)451 servicedate_field.send_keys(servicedate1)452 end453 def line1_item(item1)454 def wait_for()455 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}456 end457 wait_for {@driver.find_element(LINE1_ITEM_SPAN).displayed?}458 span_field = @driver.find_element(LINE1_ITEM_SPAN)459 span_field.click460 def wait_for2()461 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}462 end463 wait_for2 {@driver.find_element(LINE1_ITEM).displayed?}464 item_field = @driver.find_element(LINE1_ITEM)465 item_field.send_keys(item1)466 sleep(1)467 @driver.action.send_keys(:enter).perform468 sleep(2)469 end470 def line1_description(description1)471 def wait_for()472 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}473 end474 wait_for {@driver.find_element(LINE1_DESCRIPTION).displayed?}475 span_field = @driver.find_element(LINE1_DESCRIPTION)476 span_field.click477 def wait_for2()478 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}479 end480 wait_for2 {@driver.find_element(LINE1_DESCRIPTION_TEXTAREA).displayed?}481 sleep(2)482 item_field = @driver.find_element(LINE1_DESCRIPTION_TEXTAREA)483 item_field.send_keys(description1)484 sleep(1)485 @driver.action.send_keys(:enter).perform486 end487 def line1_quantity(quantity1)488 def wait_for()489 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}490 end491 wait_for {@driver.find_element(LINE1_QUANTITY_SPAN).displayed?}492 span_field = @driver.find_element(LINE1_QUANTITY_SPAN)493 span_field.click494 def wait_for2()495 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}496 end497 wait_for2 {@driver.find_element(LINE1_QUANTITY).displayed?}498 sleep(2)499 item_field = @driver.find_element(LINE1_QUANTITY)500 @driver.action.double_click(item_field).perform501 @driver.action.send_keys(:backspace)502 item_field.send_keys(quantity1)503 sleep(1)504 @driver.action.send_keys(:tab).perform505 sleep(1)506 end507 def line1_total(total1)508 def wait_for()509 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}510 end511 wait_for {@driver.find_element(LINE1_TOTAL_SPAN).displayed?}512 span_total = @driver.find_element(LINE1_TOTAL_SPAN)513 span_total.click514 def wait_for2()515 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}516 end517 wait_for2 {@driver.find_element(LINE1_TOTAL).displayed?}518 total = @driver.find_element(LINE1_TOTAL)519 total.send_keys(total1)520 end521 def line1_gettotal522 total = @driver.find_element(LINE1_TOTAL_SPAN).text.to_f523 end524 def line1_delete()525 def wait_for()526 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}527 end528 wait_for {@driver.find_element(LINE1_DELETE).displayed?}529 trashcan = @driver.find_element(LINE1_DELETE)530 trashcan.click531 sleep(2)532 end533 def line2_service_date(servicedate2)534 def wait_for()535 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}536 end537 wait_for {@driver.find_element(LINE2_SERVICE_DATE_SPAN).displayed?}538 span_field = @driver.find_element(LINE2_SERVICE_DATE_SPAN)539 span_field.click540 def wait_for2()541 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}542 end543 wait_for2 {@driver.find_element(LINE2_SERVICE_DATE).displayed?}544 servicedate_field = @driver.find_element(LINE2_SERVICE_DATE)545 servicedate_field.send_keys(servicedate2)546 end547 def line2_item(item2)548 def wait_for()549 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}550 end551 wait_for {@driver.find_element(LINE2_ITEM_SPAN).displayed?}552 span_field = @driver.find_element(LINE2_ITEM_SPAN)553 span_field.click554 def wait_for2()555 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}556 end557 wait_for2 {@driver.find_element(LINE2_ITEM).displayed?}558 item_field = @driver.find_element(LINE2_ITEM)559 item_field.send_keys(item2)560 sleep(1)561 @driver.action.send_keys(:enter).perform562 sleep(2)563 end564 def line2_description(description2)565 def wait_for()566 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}567 end568 wait_for {@driver.find_element(LINE2_DESCRIPTION).displayed?}569 span_field = @driver.find_element(LINE2_DESCRIPTION)570 span_field.click571 def wait_for2()572 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}573 end574 wait_for2 {@driver.find_element(LINE2_DESCRIPTION_TEXTAREA).displayed?}575 sleep(2)576 item_field = @driver.find_element(LINE2_DESCRIPTION_TEXTAREA)577 item_field.send_keys(description2)578 sleep(1)579 @driver.action.send_keys(:enter).perform580 end581 def line2_quantity(quantity2)582 def wait_for()583 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}584 end585 wait_for {@driver.find_element(LINE2_QUANTITY_SPAN).displayed?}586 span_field = @driver.find_element(LINE2_QUANTITY_SPAN)587 span_field.click588 def wait_for2()589 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}590 end591 wait_for2 {@driver.find_element(LINE2_QUANTITY).displayed?}592 sleep(2)593 item_field = @driver.find_element(LINE2_QUANTITY)594 @driver.action.double_click(item_field).perform595 @driver.action.send_keys(:backspace)596 item_field.send_keys(quantity2)597 sleep(1)598 @driver.action.send_keys(:tab).perform599 sleep(1)600 end601 def line2_total(total2)602 def wait_for()603 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}604 end605 wait_for {@driver.find_element(LINE2_TOTAL_SPAN).displayed?}606 span_total = @driver.find_element(LINE2_TOTAL_SPAN)607 span_total.click608 def wait_for2()609 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}610 end611 wait_for2 {@driver.find_element(LINE2_TOTAL).displayed?}612 total = @driver.find_element(LINE2_TOTAL)613 total.send_keys(total2)614 end615 def line2_gettotal616 total = @driver.find_element(LINE2_TOTAL_SPAN).text.to_f617 end618 def line2_delete()619 def wait_for()620 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}621 end622 wait_for {@driver.find_element(LINE2_DELETE).displayed?}623 trashcan = @driver.find_element(LINE2_DELETE)624 trashcan.click625 sleep(2)626 end627 def line3_service_date(servicedate3)628 def wait_for()629 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}630 end631 wait_for {@driver.find_element(LINE3_SERVICE_DATE_SPAN).displayed?}632 span_field = @driver.find_element(LINE3_SERVICE_DATE_SPAN)633 span_field.click634 def wait_for2()635 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}636 end637 wait_for2 {@driver.find_element(LINE3_SERVICE_DATE).displayed?}638 servicedate_field = @driver.find_element(LINE3_SERVICE_DATE)639 servicedate_field.send_keys(servicedate3)640 end641 def line3_item(item3)642 def wait_for()643 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}644 end645 wait_for {@driver.find_element(LINE3_ITEM_SPAN).displayed?}646 span_field = @driver.find_element(LINE3_ITEM_SPAN)647 span_field.click648 def wait_for2()649 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}650 end651 wait_for2 {@driver.find_element(LINE3_ITEM).displayed?}652 item_field = @driver.find_element(LINE3_ITEM)653 item_field.send_keys(item3)654 sleep(1)655 @driver.action.send_keys(:enter).perform656 sleep(2)657 end658 def line3_description(description3)659 def wait_for()660 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}661 end662 wait_for {@driver.find_element(LINE3_DESCRIPTION).displayed?}663 span_field = @driver.find_element(LINE3_DESCRIPTION)664 span_field.click665 def wait_for2()666 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}667 end668 wait_for2 {@driver.find_element(LINE3_DESCRIPTION_TEXTAREA).displayed?}669 sleep(2)670 item_field = @driver.find_element(LINE3_DESCRIPTION_TEXTAREA)671 item_field.send_keys(description3)672 sleep(1)673 @driver.action.send_keys(:enter).perform674 end675 def line3_quantity(quantity3)676 def wait_for()677 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}678 end679 wait_for {@driver.find_element(LINE3_QUANTITY_SPAN).displayed?}680 span_field = @driver.find_element(LINE3_QUANTITY_SPAN)681 span_field.click682 def wait_for2()683 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}684 end685 wait_for2 {@driver.find_element(LINE3_QUANTITY).displayed?}686 sleep(2)687 item_field = @driver.find_element(LINE3_QUANTITY)688 @driver.action.double_click(item_field).perform689 @driver.action.send_keys(:backspace)690 item_field.send_keys(quantity3)691 sleep(1)692 @driver.action.send_keys(:tab).perform693 sleep(1)694 end695 def line3_total(total3)696 def wait_for()697 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}698 end699 wait_for {@driver.find_element(LINE3_TOTAL_SPAN).displayed?}700 span_total = @driver.find_element(LINE3_TOTAL_SPAN)701 span_total.click702 def wait_for2()703 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}704 end705 wait_for2 {@driver.find_element(LINE3_TOTAL).displayed?}706 total = @driver.find_element(LINE3_TOTAL)707 total.send_keys(total3)708 end709 def line3_gettotal710 total = @driver.find_element(LINE3_TOTAL_SPAN).text.to_f711 end712 def line3_delete()713 def wait_for()714 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}715 end716 wait_for {@driver.find_element(LINE3_DELETE).displayed?}717 trashcan = @driver.find_element(LINE3_DELETE)718 trashcan.click719 sleep(2)720 end721 def add_lines()722 def wait_for()723 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}724 end725 wait_for {@driver.find_element(ADD_LINES).displayed?}726 button = @driver.find_element(ADD_LINES)727 button.click728 sleep(2)729 @driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")730 end731 def clear_lines()732 def wait_for()733 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}734 end735 wait_for {@driver.find_element(CLEAR_LINES).displayed?}736 @driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")737 button = @driver.find_element(CLEAR_LINES)738 button.click739 sleep(2)740 end741 def subtotal()742 subtotal = @driver.find_element(SUBTOTAL).text.gsub(/[$,]/,'').to_f743 end744 def select_tax(taxcode)745 dropdown_list = @driver.find_element(TAX_DROPDOWN)746 options = dropdown_list.find_elements(tag_name: 'option')747 options.each {|option| option.click if option.text == (taxcode)}748 end749 def taxtotal()750 taxtotal = @driver.find_element(TAXTOTAL).value.to_f751 end752 def total()753 total = @driver.find_element(TOTAL).text754 end755 #CSS Methods: Popup (Scheduling)756 def scheduling_tab()757 def wait_for()758 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}759 end760 wait_for {@driver.find_element(SCHEDULING_TAB).displayed?}761 scheduling_tab = @driver.find_element(SCHEDULING_TAB)762 scheduling_tab.click763 end764 def job_cancel(jobcancel)765 def wait_for()766 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}767 end768 wait_for {@driver.find_element(JOB_CANCELED_FIELD).displayed?}769 jobcanceled_field = @driver.find_element(JOB_CANCELED_FIELD)770 jobcanceled_field.send_keys(jobcancel)771 end772 def job_hold(jobhold)773 def wait_for()774 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}775 end776 wait_for {@driver.find_element(JOB_HOLD_FIELD).displayed?}777 jobhold_field = @driver.find_element(JOB_HOLD_FIELD)778 jobhold_field.send_keys(jobhold)779 end780 def job_complete(jobcomplete)781 def wait_for()782 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}783 end784 wait_for {@driver.find_element(JOB_COMPLETED_FIELD).displayed?}785 jobcompleted_field = @driver.find_element(JOB_COMPLETED_FIELD)786 jobcompleted_field.send_keys(jobcomplete)787 end788 def new_trip()789 def wait_for()790 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}791 end792 wait_for {@driver.find_element(NEW_TRIP_BTN).displayed?}793 new_trip = @driver.find_element(NEW_TRIP_BTN)794 new_trip.click795 end796 def trip1_crew(trip1crew)797 dropdown_list = @driver.find_element(TRIP1_CREW)798 options = dropdown_list.find_elements(tag_name: 'option')799 options.each {|option| option.click if option.text == (locationselect)}800 end801 def trip1_schedulestart(trip1schedulestart)802 def wait_for()803 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}804 end805 wait_for {@driver.find_element(TRIP1_SCHEDULED_START).displayed?}806 trip_field = @driver.find_element(TRIP1_SCHEDULED_START)807 trip_field.send_keys(trip1schedulestart)808 end809 def trip1_schedulefinish(trip1schedulefinish)810 def wait_for()811 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}812 end813 wait_for {@driver.find_element(TRIP1_SCHEDULED_FINISH).displayed?}814 trip_field = @driver.find_element(TRIP1_SCHEDULED_FINISH)815 trip_field.send_keys(trip1schedulefinish)816 end817 def trip1_start(trip1start)818 def wait_for()819 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}820 end821 wait_for {@driver.find_element(TRIP1_START).displayed?}822 trip_field = @driver.find_element(TRIP1_START)823 trip_field.send_keys(trip1start)824 end825 def trip1_finish(trip1finish)826 def wait_for()827 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}828 end829 wait_for {@driver.find_element(TRIP1_FINISH).displayed?}830 trip_field = @driver.find_element(TRIP1_FINISH)831 trip_field.send_keys(trip1finish)832 end833 def trip2_crew(trip2crew)834 dropdown_list = @driver.find_element(TRIP2_CREW)835 options = dropdown_list.find_elements(tag_name: 'option')836 options.each {|option| option.click if option.text == (locationselect)}837 end838 def trip2_schedulestart(trip2schedulestart)839 def wait_for()840 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}841 end842 wait_for {@driver.find_element(TRIP2_SCHEDULED_START).displayed?}843 trip_field = @driver.find_element(TRIP2_SCHEDULED_START)844 trip_field.send_keys(trip2schedulestart)845 end846 def trip2_schedulefinish(trip2schedulefinish)847 def wait_for()848 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}849 end850 wait_for {@driver.find_element(TRIP2_SCHEDULED_FINISH).displayed?}851 trip_field = @driver.find_element(TRIP2_SCHEDULED_FINISH)852 trip_field.send_keys(trip2schedulefinish)853 end854 def trip2_start(trip2start)855 def wait_for()856 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}857 end858 wait_for {@driver.find_element(TRIP2_START).displayed?}859 trip_field = @driver.find_element(TRIP2_START)860 trip_field.send_keys(trip2start)861 end862 def trip2_finish(trip2finish)863 def wait_for()864 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}865 end866 wait_for {@driver.find_element(TRIP2_FINISH).displayed?}867 trip_field = @driver.find_element(TRIP2_FINISH)868 trip_field.send_keys(trip2finish)869 end870 def trip3_crew(trip3crew)871 dropdown_list = @driver.find_element(TRIP3_CREW)872 options = dropdown_list.find_elements(tag_name: 'option')873 options.each {|option| option.click if option.text == (locationselect)}874 end875 def trip3_schedulestart(trip3schedulestart)876 def wait_for()877 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}878 end879 wait_for {@driver.find_element(TRIP3_SCHEDULED_START).displayed?}880 trip_field = @driver.find_element(TRIP3_SCHEDULED_START)881 trip_field.send_keys(trip3schedulestart)882 end883 def trip3_schedulefinish(trip3schedulefinish)884 def wait_for()885 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}886 end887 wait_for {@driver.find_element(TRIP3_SCHEDULED_FINISH).displayed?}888 trip_field = @driver.find_element(TRIP3_SCHEDULED_FINISH)889 trip_field.send_keys(trip3schedulefinish)890 end891 def trip3_start(trip3start)892 def wait_for()893 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}894 end895 wait_for {@driver.find_element(TRIP3_START).displayed?}896 trip_field = @driver.find_element(TRIP3_START)897 trip_field.send_keys(trip3start)898 end899 def trip3_finish(trip3finish)900 def wait_for()901 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}902 end903 wait_for {@driver.find_element(TRIP3_FINISH).displayed?}904 trip_field = @driver.find_element(TRIP3_FINISH)905 trip_field.send_keys(trip3finish)906 end907 def delete_trip1()908 def wait_for()909 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}910 end911 wait_for {@driver.find_element(DELETE_TOP_TRIP).displayed?}912 delete_trip = @driver.find_element(DELETE_TOP_TRIP)913 delete_trip.click914 end915 #CSS Methods: Popup (Contacts)916 def contacts_tab()917 def wait_for()918 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}919 end920 wait_for {@driver.find_element(CUSTOMER_CONTACTS_TAB).displayed?}921 contacts_tab = @driver.find_element(CUSTOMER_CONTACTS_TAB)922 contacts_tab.click923 end924 #Use Class - Contacts Resource from here925 #CSS Methods: Popup (Notes)926 def notes_tab()927 def wait_for()928 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}929 end930 wait_for {@driver.find_element(NOTES_TAB).displayed?}931 notes_tab = @driver.find_element(NOTES_TAB)932 notes_tab.click933 end934 def scope_of_work(scopeofwork)935 def wait_for()936 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}937 end938 wait_for {@driver.find_element(SCOPE_OF_WORK_FIELD).displayed?}939 scope_of_work = @driver.find_element(SCOPE_OF_WORK_FIELD)940 scope_of_work.send_keys(scopeofwork)941 end942 def additional_notes(additionalnotes)943 def wait_for()944 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}945 end946 wait_for {@driver.find_element(ADDITIONAL_NOTES_FIELD).displayed?}947 additional_notes = @driver.find_element(ADDITIONAL_NOTES_FIELD)948 additional_notes.send_keys(additionalnotes)949 end950 def special_instructions(specialinstructions)951 def wait_for()952 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}953 end954 wait_for {@driver.find_element(SPECIAL_INSTRUCTIONS_FIELD).displayed?}955 special_instructions = @driver.find_element(SPECIAL_INSTRUCTIONS_FIELD)956 special_instructions.send_keys(specialinstructions)957 end958 def private_notes(privatenotes)959 def wait_for()960 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}961 end962 wait_for {@driver.find_element(PRIVATE_NOTES_FIELD).displayed?}963 private_notes = @driver.find_element(PRIVATE_NOTES_FIELD)964 private_notes.send_keys(privatenotes)965 end966 #CSS Methods: Popup (Activities)967 def activities_tab()968 def wait_for()969 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}970 end971 wait_for {@driver.find_element(ACTIVITIES_TAB).displayed?}972 activities_tab = @driver.find_element(ACTIVITIES_TAB)973 activities_tab.click974 end975 def search_activity(searchactivity)976 def wait_for()977 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}978 end979 wait_for {@driver.find_element(SEARCH_ACTIVITY).displayed?}980 activity_search = @driver.find_element(SEARCH_ACTIVITY)981 activity_search.send_keys(searchactivity)982 def wait_for2()983 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}984 end985 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}986 search_confirm = @driver.find_element(SEARCH_BTN)987 search_confirm.click988 sleep(1)989 end990 def top_activity()991 def wait_for()992 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}993 end994 wait_for {driver.find_element(TOP_ACTIVITY).displayed?}995 top_refnumber = @driver.find_element(TOP_ACTIVITY)996 top_refnumber.click997 sleep(2)998 @driver.switch_to.frame(0)999 end1000 def top_activitydescription()1001 top_activitydescription = @driver.find_element(TOP_ACTIVITY_DESCRIPTION)1002 end1003 #CSS Methods: Popup (Invoices)1004 def invoices_tab()1005 def wait_for()1006 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}1007 end1008 wait_for {@driver.find_element(INVOICES_TAB).displayed?}1009 invoices_tab = @driver.find_element(INVOICES_TAB)1010 invoices_tab.click1011 end1012 def search_invoice(searchinvoice)1013 def wait_for()1014 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}1015 end1016 wait_for {@driver.find_element(SEARCH_INVOICE).displayed?}1017 invoice_search = @driver.find_element(SEARCH_INVOICE)1018 invoice_search.send_keys(searchinvoice)1019 def wait_for2()1020 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}1021 end1022 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}1023 search_confirm = @driver.find_element(SEARCH_BTN)1024 search_confirm.click1025 sleep(1)1026 end1027 def top_invoice()1028 def wait_for()1029 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}1030 end1031 wait_for {driver.find_element(TOP_INVOICE).displayed?}1032 top_refnumber = @driver.find_element(TOP_INVOICE)1033 top_refnumber.click1034 sleep(2)1035 @driver.switch_to.frame(0)1036 end1037 #CSS Methods: Popup (Deposits)1038 def deposits_tab()1039 def wait_for()1040 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}1041 end1042 wait_for {@driver.find_element(DEPOSITS_TAB).displayed?}1043 deposits_tab = @driver.find_element(DEPOSITS_TAB)1044 deposits_tab.click1045 end1046 def search_deposit(searchdeposit)1047 def wait_for()1048 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}1049 end1050 wait_for {@driver.find_element(SEARCH_DEPOSIT).displayed?}1051 deposit_search = @driver.find_element(SEARCH_DEPOSIT)1052 deposit_search.send_keys(searchdeposit)1053 def wait_for2()1054 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}1055 end1056 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}1057 search_confirm = @driver.find_element(SEARCH_BTN)1058 search_confirm.click1059 sleep(1)1060 end1061 def top_deposit()1062 def wait_for()1063 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}1064 end1065 wait_for {driver.find_element(TOP_DEPOSIT).displayed?}1066 top_refnumber = @driver.find_element(TOP_DEPOSIT)1067 top_refnumber.click1068 sleep(2)1069 @driver.switch_to.frame(0)1070 end1071 #CSS Methods: Popup (Assets)1072 def assets_tab()1073 def wait_for()1074 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}1075 end1076 wait_for {@driver.find_element(ASSETS_TAB).displayed?}1077 assets_tab = @driver.find_element(ASSETS_TAB)1078 assets_tab.click1079 end1080end...

Full Screen

Full Screen

Class - Invoices Resource.rb

Source:Class - Invoices Resource.rb Github

copy

Full Screen

...85 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}86 end87 wait_for {@driver.find_element(INVOICES_OPTN).displayed?}88 invoices_button = @driver.find_element(INVOICES_OPTN)89 invoices_button.click90 def wait_for2()91 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}92 end93 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }94 end95 def create_invoice()96 def wait_for()97 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}98 end99 wait_for {@driver.find_element(CREATE_INVOICE_BTN).displayed?}100 create_invoice_button = @driver.find_element(CREATE_INVOICE_BTN)101 create_invoice_button.click102 sleep(3)103 def wait_for2()104 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }105 end106 wait_for2 {@driver.find_element(id:"os-internal-ui-dialog-title-1").displayed?}107 sleep(2)108 @driver.switch_to.frame(0)109 end110 def select_job(selectjob)111 select_job = @driver.find_element(JOB_SEARCH_FIELD)112 select_job.send_keys(selectjob)113 sleep(1)114 @driver.action.send_keys(:enter).perform115 sleep(1)116 select_job_next = @driver.find_element(JOB_NEXT_BTN)117 select_job_next.click118 sleep(1)119 @driver.switch_to.frame(0)120 end121 def select_jobdev(selectjob)122 select_job = @driver.find_element(JOB_SEARCH_FIELD)123 select_job.send_keys(selectjob)124 sleep(1)125 @driver.action.send_keys(:enter).perform126 sleep(1)127 select_job_next = @driver.find_element(JOB_NEXT_BTN)128 select_job_next.click129 sleep(4)130 @driver.switch_to.frame(0)131 end132 def top()133 top_record = @driver.find_element(TOP_INVOICE)134 end135 def top_jobname()136 top_record = @driver.find_element(TOP_JOBNAME)137 end138 def top_refnumber()139 top_refnumber = @driver.find_element(TOP_REFNUMBER)140 end141 def top_qbid()142 top_qbid = @driver.find_element(TOP_QBID)143 end144 def top_nsid()145 top_qbid = @driver.find_element(TOP_NSID)146 end147 def top_ponumber()148 top_ponumber = @driver.find_element(TOP_PONUMBER)149 end150 def top_open()151 def wait_for()152 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}153 end154 wait_for {@driver.find_element(TOP_REFNUMBER).displayed?}155 top_refnumber = @driver.find_element(TOP_REFNUMBER)156 top_refnumber.click157 sleep(2)158 @driver.switch_to.frame(0)159 end160 def top_actions()161 def wait_for()162 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}163 end164 wait_for {@driver.find_element(TOP_INVOICE_ACTIONS).displayed?}165 top_actions = @driver.find_element(TOP_INVOICE_ACTIONS)166 top_actions.click167 end168 def actions_viewinvoice()169 #Only accessible in grid actions170 def wait_for()171 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}172 end173 wait_for {@driver.find_element(ACTIONS_VIEWINVOICE).displayed?}174 top_view = @driver.find_element(ACTIONS_VIEWINVOICE)175 top_view.click176 sleep(2)177 @driver.switch_to.frame(0)178 end179 def actions_createactivity()180 def wait_for()181 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}182 end183 wait_for {@driver.find_element(ACTIONS_CREATEACTIVITY).displayed?}184 top_createactivity = @driver.find_element(ACTIONS_CREATEACTIVITY)185 top_createactivity.click186 sleep(2)187 @driver.switch_to.frame(0)188 end189 def actions_documents()190 def wait_for()191 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}192 end193 wait_for {@driver.find_element(ACTIONS_DOCUMENTS).displayed?}194 top_documents = @driver.find_element(ACTIONS_DOCUMENTS)195 top_documents.click196 sleep(2)197 @driver.switch_to.frame(0)198 end199 def actions_printemail()200 def wait_for()201 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}202 end203 wait_for {@driver.find_element(ACTIONS_PRINTEMAIL).displayed?}204 top_printemail = @driver.find_element(ACTIONS_PRINTEMAIL)205 top_printemail.click206 sleep(2)207 @driver.switch_to.frame(0)208 end209 def search_invoice(searchname)210 def wait_for()211 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}212 end213 wait_for {@driver.find_element(SEARCH_FIELD).displayed?}214 job_search = @driver.find_element(SEARCH_FIELD)215 job_search.send_keys(searchname)216 def wait_for2()217 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}218 end219 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}220 search_confirm = @driver.find_element(SEARCH_BTN)221 search_confirm.click222 sleep(2)223 end224 def search_invoiceid(searchname)225 def wait_for()226 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}227 end228 wait_for {@driver.find_element(ID_COLUMN).displayed?}229 invoice_search = @driver.find_element(ID_COLUMN)230 invoice_search.send_keys(searchname)231 sleep(3)232 end233 def search_invoicename(searchname)234 def wait_for()235 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}236 end237 wait_for {@driver.find_element(NAME_COLUMN).displayed?}238 invoice_search = @driver.find_element(NAME_COLUMN)239 invoice_search.send_keys(searchname)240 sleep(3)241 end242 def search_reset()243 def wait_for()244 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}245 end246 wait_for {@driver.find_element(RESET_BTN).displayed?}247 search_reset = @driver.find_element(RESET_BTN)248 search_reset.click249 end250 def grid_options()251 def wait_for()252 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}253 end254 wait_for {@driver.find_element(GRID_OPTIONS_DROPDOWN).displayed?}255 grid_options = @driver.find_element(GRID_OPTIONS_DROPDOWN)256 grid_options.click257 end258 def export_invoices()259 def wait_for()260 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}261 end262 wait_for {@driver.find_element(EXPORT_INVOICES).displayed?}263 export_jobs = @driver.find_element(EXPORT_INVOICES)264 export_jobs.click265 end266 def show_inactives()267 def wait_for()268 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}269 end270 wait_for {@driver.find_element(SHOW_INACTIVES).displayed?}271 show_inactives = @driver.find_element(SHOW_INACTIVES)272 show_inactives.click273 end274 def qbo_verify()275 def wait_for276 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }277 end278 wait_for {@driver.find_element(TOP_QBID).displayed?}279 qbid = @driver.find_element(TOP_QBID)280 qbid_display = qbid.text281 expect(qbid_display).not_to eq("")282 print "QBID: %s" % qbid_display283 end284 def ns_verify()285 def wait_for286 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }287 end288 wait_for {@driver.find_element(TOP_NSID).displayed?}289 nsid = @driver.find_element(TOP_NSID)290 nsid_display = nsid.text291 expect(qbid_display).not_to eq("")292 print "NS Invoice Number: %s" % nsid_display293 end294 def grid_total()295 gridtotal = @driver.find_element(GRID_TOTAL)296 end297 def resource_performance()298 navigationStart = driver.execute_script("return window.performance.timing.navigationStart")299 responseStart = driver.execute_script("return window.performance.timing.responseStart")300 domComplete = driver.execute_script("return window.performance.timing.domComplete")301 loadPerformance = domComplete - navigationStart302 def wait_for303 Selenium::WebDriver::Wait.new(:timeout => 20).until { yield }304 end305 wait_for {driver.find_element(GRID_TOTAL).text != "0 records" }306 invoices_records = driver.find_element(GRID_TOTAL)307 invoices_count = invoices_records.text308 print "Invoices: \n"309 print "%s \n" % invoices_count310 print "Load Time: %s ms \n\n" % loadPerformance311 end312 #CSS Methods: Popup313 def invoice_date(invoicedate)314 def wait_for315 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }316 end317 wait_for {@driver.find_element(INVOICE_DATE_FIELD).displayed?}318 invoice_date = @driver.find_element(INVOICE_DATE_FIELD)319 invoice_date.send_keys(jobname)320 end321 def terms(termsselect)322 def wait_for323 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }324 end325 wait_for {@driver.find_element(TERMS_DROPDOWN).displayed?}326 dropdown_list = @driver.find_element(TERMS_DROPDOWN)327 options = dropdown_list.find_elements(tag_name: 'option')328 options.each {|option| option.click if option.text == (termsselect)}329 end330 def due_date(duedate)331 def wait_for332 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }333 end334 wait_for {@driver.find_element(DUE_DATE_FIELD).displayed?}335 duedate = @driver.find_element(DUE_DATE_FIELD)336 duedate.send_keys(duedate)337 end338 def location(locationselect)339 dropdown_list = @driver.find_element(LOCATION_DROPDOWN)340 options = dropdown_list.find_elements(tag_name: 'option')341 options.each {|option| option.click if option.text == (locationselect)}342 end343 def class(classselect)344 def wait_for345 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }346 end347 wait_for {@driver.find_element(CLASS_DROPDOWN).displayed?}348 dropdown_list = @driver.find_element(CLASS_DROPDOWN)349 options = dropdown_list.find_elements(tag_name: 'option')350 options.each {|option| option.click if option.text == (classselect)}351 end352 def line_business(lineofbusiness)353 def wait_for354 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }355 end356 wait_for {@driver.find_element(LINE_OF_BUSINESS_DROPDOWN).displayed?}357 dropdown_list = @driver.find_element(LINE_OF_BUSINESS_DROPDOWN)358 options = dropdown_list.find_elements(tag_name: 'option')359 options.each {|option| option.click if option.text == (lineofbusiness)}360 end361 def po_number(ponumber)362 def wait_for363 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }364 end365 wait_for {@driver.find_element(PONUMBER_FIELD).displayed?}366 po_number = @driver.find_element(PONUMBER_FIELD)367 po_number.send_keys(ponumber)368 end369 def account_executive(accountexecutive)370 def wait_for371 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }372 end373 wait_for {@driver.find_element(ACCOUNT_EXECUTIVE_DROPDOWN).displayed?}374 dropdown_list = @driver.find_element(ACCOUNT_EXECUTIVE_DROPDOWN)375 options = dropdown_list.find_elements(tag_name: 'option')376 options.each {|option| option.click if option.text == (accountexecutive)}377 end378 def commission(comissionschedule)379 def wait_for380 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }381 end382 wait_for {@driver.find_element(COMMISSION_SCHEDULE_DROPDOWN).displayed?}383 dropdown_list = @driver.find_element(COMMISSION_SCHEDULE_DROPDOWN)384 options = dropdown_list.find_elements(tag_name: 'option')385 options.each {|option| option.click if option.text == (comissionschedule)}386 end387 def cancel()388 def wait_for()389 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}390 end391 wait_for {@driver.find_element(CANCEL_BTN).displayed?}392 cancel_popup = @driver.find_element(CANCEL_BTN)393 cancel_popup.click394 end395 def actions()396 #Use actions_(action) methods from here397 def wait_for()398 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}399 end400 wait_for {@driver.find_element(ACTIONS_BTN).displayed?}401 actions_popup = @driver.find_element(ACTIONS_BTN)402 actions_popup.click403 end404 def actions_viewjob()405 #Only accessible in popup actions406 def wait_for()407 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}408 end409 wait_for {@driver.find_element(ACTIONS_VIEWJOB).displayed?}410 viewjob = @driver.find_element(ACTIONS_VIEWJOB)411 viewjob.click412 sleep(2)413 @driver.switch_to.frame(0)414 end415 def actions_viewcustomer()416 #Only accessible in popup actions417 def wait_for()418 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}419 end420 wait_for {@driver.find_element(ACTIONS_VIEWCUSTOMER).displayed?}421 viewcustomer = @driver.find_element(ACTIONS_VIEWCUSTOMER)422 viewcustomer.click423 sleep(2)424 @driver.switch_to.frame(0)425 end426 def actions_pushtoqbo()427 #Only accessible in popup actions428 def wait_for()429 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}430 end431 wait_for {@driver.find_element(ACTIONS_PUSHTOQBO).displayed?}432 pushtoqbo = @driver.find_element(ACTIONS_PUSHTOQBO)433 pushtoqbo.click434 def wait_for2()435 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}436 end437 wait_for2 {@driver.find_element(PUSH_CONFIRM).displayed?}438 confirm = @driver.find_element(PUSH_CONFIRM)439 confirm.click440 sleep(3)441 end442 def actions_pushtons()443 #Only accessible in popup actions444 def wait_for()445 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}446 end447 wait_for {@driver.find_element(ACTIONS_PUSHTONS).displayed?}448 pushtons = @driver.find_element(ACTIONS_PUSHTONS)449 pushtons.click450 def wait_for2()451 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}452 end453 wait_for2 {@driver.find_element(PUSH_CONFIRM).displayed?}454 confirm = @driver.find_element(PUSH_CONFIRM)455 confirm.click456 sleep(3)457 end458 def actions_pullfromqbo()459 #Only accessible in popup actions460 def wait_for()461 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}462 end463 wait_for {@driver.find_element(ACTIONS_PULLFROMQBO).displayed?}464 pullfromqbo = @driver.find_element(ACTIONS_PULLFROMQBO)465 pullfromqbo.click466 sleep(3)467 end468 def actions_viewinqbo()469 #Only accessible in popup actions470 def wait_for()471 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}472 end473 wait_for {@driver.find_element(ACTIONS_VIEWINQBO).displayed?}474 pullfromqbo = @driver.find_element(ACTIONS_VIEWINQBO)475 pullfromqbo.click476 end477 def save()478 def wait_for()479 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}480 end481 wait_for {@driver.find_element(SAVE_BTN).displayed?}482 save = @driver.find_element(SAVE_BTN)483 save.click484 end485 def save_close()486 def wait_for()487 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}488 end489 wait_for {@driver.find_element(SAVE_AND_CLOSE_BTN).displayed?}490 save_and_close = @driver.find_element(SAVE_AND_CLOSE_BTN)491 save_and_close.click492 sleep(3)493 end494 #CSS Methods: Popup (Lines)495 def lines_tab()496 def wait_for()497 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}498 end499 wait_for {@driver.find_element(LINES_TAB).displayed?}500 lines_tab = @driver.find_element(LINES_TAB)501 lines_tab.click502 end503 def line1_service_date(servicedate1)504 def wait_for()505 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}506 end507 wait_for {@driver.find_element(LINE1_SERVICE_DATE_SPAN).displayed?}508 span_field = @driver.find_element(LINE1_SERVICE_DATE_SPAN)509 span_field.click510 def wait_for2()511 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}512 end513 wait_for2 {@driver.find_element(LINE1_SERVICE_DATE).displayed?}514 servicedate_field = @driver.find_element(LINE1_SERVICE_DATE)515 servicedate_field.send_keys(servicedate1)516 end517 def line1_item(item1)518 def wait_for()519 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}520 end521 wait_for {@driver.find_element(LINE1_ITEM_SPAN).displayed?}522 span_field = @driver.find_element(LINE1_ITEM_SPAN)523 span_field.click524 def wait_for2()525 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}526 end527 wait_for2 {@driver.find_element(LINE1_SERVICE_DATE).displayed?}528 item_field = @driver.find_element(LINE1_SERVICE_DATE)529 item_field.send_keys(item1)530 sleep(1)531 @driver.action.send_keys(:enter).perform532 end533 def line1_description(description1)534 def wait_for()535 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}536 end537 wait_for {@driver.find_element(LINE1_DESCRIPTION).displayed?}538 span_field = @driver.find_element(LINE1_DESCRIPTION)539 span_field.click540 def wait_for2()541 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}542 end543 wait_for2 {@driver.find_element(LINE1_DESCRIPTION_TEXTAREA).displayed?}544 sleep(2)545 item_field = @driver.find_element(LINE1_DESCRIPTION_TEXTAREA)546 item_field.send_keys(description1)547 sleep(1)548 @driver.action.send_keys(:enter).perform549 end550 def line1_delete()551 def wait_for()552 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}553 end554 wait_for {@driver.find_element(LINE1_DELETE).displayed?}555 trashcan = @driver.find_element(LINE1_DELETE)556 trashcan.click557 sleep(2)558 end559 def add_lines()560 def wait_for()561 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}562 end563 wait_for {@driver.find_element(ADD_LINES).displayed?}564 button = @driver.find_element(ADD_LINES)565 button.click566 sleep(2)567 @driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")568 end569 def clear_lines()570 def wait_for()571 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}572 end573 wait_for {@driver.find_element(CLEAR_LINES).displayed?}574 @driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")575 button = @driver.find_element(CLEAR_LINES)576 button.click577 sleep(2)578 end579 def subtotal()580 subtotal = @driver.find_element(SUBTOTAL).text.gsub(/[$,]/,'').to_f581 end582 def select_tax(taxcode)583 dropdown_list = @driver.find_element(TAX_DROPDOWN)584 options = dropdown_list.find_elements(tag_name: 'option')585 options.each {|option| option.click if option.text == (taxcode)}586 end587 def taxtotal()588 taxtotal = @driver.find_element(TAXTOTAL).value.to_f589 end590 def total()591 total = @driver.find_element(TOTAL).text592 end593 #CSS Methods: Popup (Contacts)594 def contacts_tab()595 def wait_for()596 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}597 end598 wait_for {@driver.find_element(CUSTOMER_CONTACTS_TAB).displayed?}599 contacts_tab = @driver.find_element(CUSTOMER_CONTACTS_TAB)600 contacts_tab.click601 end602 #Use Class - Contacts Resource from here603 #CSS Methods: Popup (Notes)604 def notes_tab()605 def wait_for()606 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}607 end608 wait_for {@driver.find_element(NOTES_TAB).displayed?}609 notes_tab = @driver.find_element(NOTES_TAB)610 notes_tab.click611 end612 def customer_memo(customermemo)613 def wait_for()614 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}615 end616 wait_for {@driver.find_element(CUSTOMER_MEMO_FIELD).displayed?}617 customer_memo = @driver.find_element(CUSTOMER_MEMO_FIELD)618 customer_memo.send_keys(customermemo)619 end620 def private_notes(privatenotes)621 def wait_for()622 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}623 end624 wait_for {@driver.find_element(PRIVATE_NOTES_FIELD).displayed?}625 private_notes = @driver.find_element(PRIVATE_NOTES_FIELD)626 private_notes.send_keys(privatenotes)627 end628 #CSS Methods: Popup (Activities)629 def activities_tab()630 def wait_for()631 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}632 end633 wait_for {@driver.find_element(ACTIVITIES_TAB).displayed?}634 activities_tab = @driver.find_element(ACTIVITIES_TAB)635 activities_tab.click636 end637 def search_activity(searchactivity)638 def wait_for()639 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}640 end641 wait_for {@driver.find_element(SEARCH_ACTIVITY).displayed?}642 activity_search = @driver.find_element(SEARCH_ACTIVITY)643 activity_search.send_keys(searchactivity)644 def wait_for2()645 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}646 end647 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}648 search_confirm = @driver.find_element(SEARCH_BTN)649 search_confirm.click650 sleep(1)651 end652 def top_activity()653 def wait_for()654 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}655 end656 wait_for {driver.find_element(TOP_ACTIVITY).displayed?}657 top_refnumber = @driver.find_element(TOP_ACTIVITY)658 top_refnumber.click659 sleep(2)660 @driver.switch_to.frame(0)661 end662 def top_activitydescription()663 top_activitydescription = @driver.find_element(TOP_ACTIVITY_DESCRIPTION)664 end665end...

Full Screen

Full Screen

Class - Estimates Resource.rb

Source:Class - Estimates Resource.rb Github

copy

Full Screen

...94 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}95 end96 wait_for {@driver.find_element(ESTIMATES_OPTN).displayed?}97 estimates_button = @driver.find_element(ESTIMATES_OPTN)98 estimates_button.click99 def wait_for2()100 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}101 end102 wait_for2 {driver.find_element(class: "Counter_Message").text != "0 records" }103 end104 def create_estimate()105 def wait_for()106 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}107 end108 wait_for {@driver.find_element(CREATE_ESTIMATE_BTN).displayed?}109 create_esimate_button = @driver.find_element(CREATE_ESTIMATE_BTN)110 create_esimate_button.click111 sleep(2)112 @driver.switch_to.frame(0)113 end114 def select_customer(selectcustomer)115 select_customer = @driver.find_element(CUSTOMER_SEARCH_FIELD)116 select_customer.send_keys(selectcustomer)117 sleep(1)118 @driver.action.send_keys(:enter).perform119 sleep(1)120 select_customer_next = @driver.find_element(CUSTOMER_NEXT_BTN)121 select_customer_next.click122 sleep(1)123 @driver.switch_to.frame(0)124 end125 def top()126 top_record = @driver.find_element(TOP_ESTIMATE)127 end128 def top_refnumber()129 top_refnumber = @driver.find_element(TOP_REFNUMBER)130 end131 def top_status()132 top_refnumber = @driver.find_element(TOP_STATUS)133 end134 def top_stage()135 top_refnumber = @driver.find_element(TOP_STAGE)136 end137 def top_type()138 top_refnumber = @driver.find_element(TOP_TYPE)139 end140 def top_open()141 def wait_for()142 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}143 end144 wait_for {@driver.find_element(TOP_REFNUMBER).displayed?}145 top_refnumber = @driver.find_element(TOP_REFNUMBER)146 top_refnumber.click147 sleep(2)148 @driver.switch_to.frame(0)149 end150 def top_actions()151 def wait_for()152 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}153 end154 wait_for {@driver.find_element(TOP_ESTIMATE_ACTIONS).displayed?}155 top_actions = @driver.find_element(TOP_ESTIMATE_ACTIONS)156 top_actions.click157 end158 def top_viewestimate()159 #Only accessible in grid actions160 def wait_for()161 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}162 end163 wait_for {@driver.find_element(ACTIONS_VIEWESTIMATE).displayed?}164 top_view = @driver.find_element(ACTIONS_VIEWESTIMATE)165 top_view.click166 sleep(2)167 @driver.switch_to.frame(0)168 end169 def actions_createactivity()170 def wait_for()171 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}172 end173 wait_for {@driver.find_element(ACTIONS_CREATEACTIVITY).displayed?}174 top_createactivity = @driver.find_element(ACTIONS_CREATEACTIVITY)175 top_createactivity.click176 sleep(2)177 @driver.switch_to.frame(0)178 end179 def actions_createinvoice()180 def wait_for()181 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}182 end183 wait_for {@driver.find_element(ACTIONS_CREATEINVOICE).displayed?}184 top_createinvoice = @driver.find_element(ACTIONS_CREATEINVOICE)185 top_createinvoice.click186 sleep(2)187 @driver.switch_to.frame(0)188 end189 def actions_documents()190 def wait_for()191 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}192 end193 wait_for {@driver.find_element(ACTIONS_DOCUMENTS).displayed?}194 top_documents = @driver.find_element(ACTIONS_DOCUMENTS)195 top_documents.click196 sleep(2)197 @driver.switch_to.frame(0)198 end199 def actions_printemail()200 def wait_for()201 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}202 end203 wait_for {@driver.find_element(ACTIONS_PRINTEMAIL).displayed?}204 top_printemail = @driver.find_element(ACTIONS_PRINTEMAIL)205 top_printemail.click206 sleep(2)207 @driver.switch_to.frame(0)208 end209 def actions_duplicateestimate()210 def wait_for()211 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}212 end213 wait_for {@driver.find_element(ACTIONS_DUPLICATEESTIMATE).displayed?}214 top_duplicate = @driver.find_element(ACTIONS_DUPLICATEESTIMATE)215 top_duplicate.click216 sleep(2)217 @driver.switch_to.frame(0)218 end219 def actions_makeinactive()220 def wait_for()221 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}222 end223 wait_for {@driver.find_element(ACTIONS_MAKEINACTIVE).displayed?}224 top_makeinactive = @driver.find_element(ACTIONS_MAKEINACTIVE)225 top_makeinactive.click226 end227 def search_estimate(searchname)228 def wait_for()229 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}230 end231 wait_for {@driver.find_element(SEARCH_FIELD).displayed?}232 record_search = @driver.find_element(SEARCH_FIELD)233 record_search.send_keys(searchname)234 def wait_for2()235 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}236 end237 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}238 search_confirm = @driver.find_element(SEARCH_BTN)239 search_confirm.click240 sleep(2)241 end242 def search_estimateid(searchname)243 def wait_for()244 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}245 end246 wait_for {@driver.find_element(ID_COLUMN).displayed?}247 estimate_search = @driver.find_element(ID_COLUMN)248 estimate_search.send_keys(searchname)249 sleep(3)250 end251 def search_estimatename(searchname)252 def wait_for()253 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}254 end255 wait_for {@driver.find_element(NAME_COLUMN).displayed?}256 estimate_search = @driver.find_element(NAME_COLUMN)257 estimate_search.send_keys(searchname)258 sleep(3)259 end260 def search_reset()261 def wait_for()262 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}263 end264 wait_for {@driver.find_element(RESET_BTN).displayed?}265 search_reset = @driver.find_element(RESET_BTN)266 search_reset.click267 end268 def grid_options()269 def wait_for()270 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}271 end272 wait_for {@driver.find_element(GRID_OPTIONS_DROPDOWN).displayed?}273 grid_options = @driver.find_element(GRID_OPTIONS_DROPDOWN)274 grid_options.click275 end276 def export_estimates()277 def wait_for()278 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}279 end280 wait_for {@driver.find_element(EXPORT_ESTIMATES).displayed?}281 export_estimates = @driver.find_element(EXPORT_ESTIMATES)282 export_estimates.click283 end284 def show_inactives()285 def wait_for()286 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}287 end288 wait_for {@driver.find_element(SHOW_INACTIVES).displayed?}289 show_inactives = @driver.find_element(SHOW_INACTIVES)290 show_inactives.click291 end292 def grid_total()293 gridtotal = @driver.find_element(GRID_TOTAL)294 end295 def resource_performance()296 navigationStart = driver.execute_script("return window.performance.timing.navigationStart")297 responseStart = driver.execute_script("return window.performance.timing.responseStart")298 domComplete = driver.execute_script("return window.performance.timing.domComplete")299 loadPerformance = domComplete - navigationStart300 def wait_for301 Selenium::WebDriver::Wait.new(:timeout => 20).until { yield }302 end303 wait_for {driver.find_element(GRID_TOTAL).text != "0 records" }304 estimates_records = driver.find_element(GRID_TOTAL)305 estimates_count = estimates_records.text306 print "Estimates: \n"307 print "%s \n" % estimates_count308 print "Load Time: %s ms \n\n" % loadPerformance309 end310 #CSS Methods: Popup311 def name(estimatename)312 estimate_name = @driver.find_element(NAME_FIELD)313 estimate_name.send_keys(estimatename)314 end315 def location(locationselect)316 dropdown_list = @driver.find_element(LOCATION_DROPDOWN)317 options = dropdown_list.find_elements(tag_name: 'option')318 options.each {|option| option.click if option.text == (locationselect)}319 end320 def type(typeselect)321 dropdown_list = @driver.find_element(TYPE_DROPDOWN)322 options = dropdown_list.find_elements(tag_name: 'option')323 options.each {|option| option.click if option.text == (typeselect)}324 end325 def stage(stageselect)326 dropdown_list = @driver.find_element(STAGE_DROPDOWN)327 options = dropdown_list.find_elements(tag_name: 'option')328 options.each {|option| option.click if option.text == (stageselect)}329 end330 def customer(customername)331 customer_name = @driver.find_element(CUSTOMER_FIELD)332 customer_name.send_keys(customername)333 end334 def patrol(patrolname)335 patrol_name = @driver.find_element(PATROL_FIELD)336 patrol_name.send_keys(patrolname)337 end338 def effective_on(effectiveon)339 estimate_name = @driver.find_element(EFFECTIVEON_FIELD)340 estimate_name.send_keys(effectiveon)341 end342 def expires_on(ponumber)343 po_number = @driver.find_element(EXPIRESON_FIELD)344 po_number.send_keys(ponumber)345 end346 def account_executive(accountexecutive)347 dropdown_list = @driver.find_element(ACCOUNT_EXECUTIVE_DROPDOWN)348 options = dropdown_list.find_elements(tag_name: 'option')349 options.each {|option| option.click if option.text == (accountexecutive)}350 end351 def nte(ntefield)352 po_number = @driver.find_element(NTE_FIELD)353 po_number.send_keys(ntefield)354 end355 def cancel()356 def wait_for()357 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}358 end359 wait_for {@driver.find_element(CANCEL_BTN).displayed?}360 cancel_popup = @driver.find_element(CANCEL_BTN)361 cancel_popup.click362 end363 def actions()364 #Use actions_(action) methods from here365 def wait_for()366 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}367 end368 wait_for {@driver.find_element(ACTIONS_BTN).displayed?}369 actions_popup = @driver.find_element(ACTIONS_BTN)370 actions_popup.click371 end372 def save()373 def wait_for()374 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}375 end376 wait_for {@driver.find_element(SAVE_BTN).displayed?}377 save = @driver.find_element(SAVE_BTN)378 save.click379 end380 def save_close()381 sleep(2)382 def wait_for()383 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}384 end385 wait_for {@driver.find_element(SAVE_AND_CLOSE_BTN).displayed?}386 save_and_close = @driver.find_element(SAVE_AND_CLOSE_BTN)387 save_and_close.click388 sleep(2)389 end390 #CSS Methods: Popup (Lines)391 def lines_tab()392 def wait_for()393 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}394 end395 wait_for {@driver.find_element(LINES_TAB).displayed?}396 lines_tab = @driver.find_element(LINES_TAB)397 lines_tab.click398 end399 def line1_item(item1)400 def wait_for()401 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}402 end403 wait_for {@driver.find_element(LINE1_ITEM_SPAN).displayed?}404 span_field = @driver.find_element(LINE1_ITEM_SPAN)405 span_field.click406 def wait_for2()407 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}408 end409 wait_for2 {@driver.find_element(LINE1_SERVICE_DATE).displayed?}410 item_field = @driver.find_element(LINE1_SERVICE_DATE)411 item_field.send_keys(item1)412 sleep(1)413 @driver.action.send_keys(:enter).perform414 end415 #CSS Methods: Popup (Scheduling)416 def scheduling_tab()417 def wait_for()418 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}419 end420 wait_for {@driver.find_element(SCHEDULING_TAB).displayed?}421 scheduling_tab = @driver.find_element(SCHEDULING_TAB)422 scheduling_tab.click423 end424 def estimate_cancel(jobcancel)425 def wait_for()426 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}427 end428 wait_for {@driver.find_element(JOB_CANCELED_FIELD).displayed?}429 jobcanceled_field = @driver.find_element(JOB_CANCELED_FIELD)430 jobcanceled_field.send_keys(jobcancel)431 end432 def estimate_hold(jobhold)433 def wait_for()434 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}435 end436 wait_for {@driver.find_element(JOB_HOLD_FIELD).displayed?}437 jobhold_field = @driver.find_element(JOB_HOLD_FIELD)438 jobhold_field.send_keys(jobhold)439 end440 def estimate_complete(jobcomplete)441 def wait_for()442 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}443 end444 wait_for {@driver.find_element(JOB_COMPLETED_FIELD).displayed?}445 jobcompleted_field = @driver.find_element(JOB_COMPLETED_FIELD)446 jobcompleted_field.send_keys(jobcomplete)447 end448 #CSS Methods: Popup (Contacts)449 def contacts_tab()450 def wait_for()451 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}452 end453 wait_for {@driver.find_element(CUSTOMER_CONTACTS_TAB).displayed?}454 contacts_tab = @driver.find_element(CUSTOMER_CONTACTS_TAB)455 contacts_tab.click456 end457 #Use Class - Contacts Resource from here458 #CSS Methods: Popup (Notes)459 def notes_tab()460 def wait_for()461 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}462 end463 wait_for {@driver.find_element(NOTES_TAB).displayed?}464 notes_tab = @driver.find_element(NOTES_TAB)465 notes_tab.click466 end467 def scope_of_work(scopeofwork)468 def wait_for()469 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}470 end471 wait_for {@driver.find_element(SCOPE_OF_WORK_FIELD).displayed?}472 scope_of_work = @driver.find_element(SCOPE_OF_WORK_FIELD)473 scope_of_work.send_keys(scopeofwork)474 end475 def additional_notes(additionalnotes)476 def wait_for()477 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}478 end479 wait_for {@driver.find_element(ADDITIONAL_NOTES_FIELD).displayed?}480 additional_notes = @driver.find_element(ADDITIONAL_NOTES_FIELD)481 additional_notes.send_keys(additionalnotes)482 end483 def special_instructions(specialinstructions)484 def wait_for()485 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}486 end487 wait_for {@driver.find_element(SPECIAL_INSTRUCTIONS_FIELD).displayed?}488 special_instructions = @driver.find_element(SPECIAL_INSTRUCTIONS_FIELD)489 special_instructions.send_keys(specialinstructions)490 end491 def private_notes(privatenotes)492 def wait_for()493 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}494 end495 wait_for {@driver.find_element(PRIVATE_NOTES_FIELD).displayed?}496 private_notes = @driver.find_element(PRIVATE_NOTES_FIELD)497 private_notes.send_keys(privatenotes)498 end499 #CSS Methods: Popup (Activities)500 def activities_tab()501 def wait_for()502 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}503 end504 wait_for {@driver.find_element(ACTIVITIES_TAB).displayed?}505 activities_tab = @driver.find_element(ACTIVITIES_TAB)506 activities_tab.click507 end508 def search_activity(searchactivity)509 def wait_for()510 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}511 end512 wait_for {@driver.find_element(SEARCH_ACTIVITY).displayed?}513 activity_search = @driver.find_element(SEARCH_ACTIVITY)514 activity_search.send_keys(searchactivity)515 def wait_for2()516 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}517 end518 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}519 search_confirm = @driver.find_element(SEARCH_BTN)520 search_confirm.click521 sleep(1)522 end523 def top_activity()524 def wait_for()525 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}526 end527 wait_for {@driver.find_element(TOP_ACTIVITY).displayed?}528 top_refnumber = @driver.find_element(TOP_ACTIVITY)529 top_refnumber.click530 sleep(2)531 @driver.switch_to.frame(0)532 end533 def top_activitydescription()534 top_activitydescription = @driver.find_element(TOP_ACTIVITY_DESCRIPTION)535 end536 #CSS Methods: Popup (Jobs)537 def jobs_tab()538 def wait_for()539 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}540 end541 wait_for {@driver.find_element(JOBS_TAB).displayed?}542 jobs_tab = @driver.find_element(JOBS_TAB)543 jobs_tab.click544 end545 def search_job(searchjob)546 def wait_for()547 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}548 end549 wait_for {@driver.find_element(SEARCH_JOB).displayed?}550 job_search = @driver.find_element(SEARCH_JOB)551 job_search.send_keys(searchjob)552 def wait_for2()553 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}554 end555 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}556 search_confirm = @driver.find_element(SEARCH_BTN)557 search_confirm.click558 sleep(1)559 end560 def top_invoice()561 def wait_for()562 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}563 end564 wait_for {@driver.find_element(TOP_JOB).displayed?}565 top_refnumber = @driver.find_element(TOP_JOB)566 top_refnumber.click567 sleep(2)568 @driver.switch_to.frame(0)569 end570end...

Full Screen

Full Screen

Class - Patrols Resource.rb

Source:Class - Patrols Resource.rb Github

copy

Full Screen

...72 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}73 end74 wait_for {@driver.find_element(PATROLS_OPTN).displayed?}75 patrols_button = @driver.find_element(PATROLS_OPTN)76 patrols_button.click77 def wait_for2()78 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}79 end80 wait_for2 {driver.find_element(class: "Counter_Message").text != "0 records"}81 end82 def create_patrol()83 def wait_for()84 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}85 end86 wait_for {@driver.find_element(CREATE_PATROL_BTN).displayed?}87 create_patrol_button = @driver.find_element(CREATE_PATROL_BTN)88 create_patrol_button.click89 sleep(3)90 def wait_for2()91 Selenium::WebDriver::Wait.new(:timeout => 10).until { yield }92 end93 wait_for2 {@driver.find_element(id:"WebForm1").displayed?}94 sleep(2)95 @driver.switch_to.frame(0)96 end97 def top()98 top_record = @driver.find_element(TOP_PATROL)99 end100 def top_refnumber()101 top_refnumber = @driver.find_element(TOP_REFNUMBER)102 end103 def top_customer()104 top_customer = @driver.find_element(TOP_PATROL_CUSTOMER)105 end106 def top_open()107 def wait_for()108 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}109 end110 wait_for {@driver.find_element(TOP_REFNUMBER).displayed?}111 top_refnumber = @driver.find_element(TOP_REFNUMBER)112 top_refnumber.click113 sleep(2)114 @driver.switch_to.frame(0)115 end116 def top_actions()117 def wait_for()118 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}119 end120 wait_for {@driver.find_element(TOP_PATROL_ACTIONS).displayed?}121 top_actions = @driver.find_element(TOP_PATROL_ACTIONS)122 top_actions.click123 end124 def top_viewpatrol()125 #Only accessible in grid actions126 def wait_for()127 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}128 end129 wait_for {@driver.find_element(ACTIONS_VIEWPATROL).displayed?}130 top_viewpatrol = @driver.find_element(ACTIONS_VIEWPATROL)131 top_viewpatrol.click132 sleep(2)133 @driver.switch_to.frame(1)134 end135 def actions_createactivity()136 def wait_for()137 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}138 end139 wait_for {@driver.find_element(ACTIONS_CREATEACTIVITY).displayed?}140 top_createactivity = @driver.find_element(ACTIONS_CREATEACTIVITY)141 top_createactivity.click142 sleep(2)143 @driver.switch_to.frame(1)144 end145 def actions_createestimate()146 def wait_for()147 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}148 end149 wait_for {@driver.find_element(ACTIONS_CREATEESTIMATE).displayed?}150 top_createestimate = @driver.find_element(ACTIONS_CREATEESTIMATE)151 top_createestimate.click152 sleep(2)153 @driver.switch_to.frame(1)154 end155 def actions_createjob()156 def wait_for()157 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}158 end159 wait_for {@driver.find_element(TOP_PATROL_CREATEJOB).displayed?}160 top_createjob = @driver.find_element(TOP_PATROL_CREATEJOB)161 top_createjob.click162 sleep(2)163 @driver.switch_to.frame(1)164 end165 def actions_documents()166 def wait_for()167 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}168 end169 wait_for {@driver.find_element(ACTIONS_DOCUMENTS).displayed?}170 top_documents = @driver.find_element(ACTIONS_DOCUMENTS)171 top_documents.click172 end173 def actions_printemail()174 def wait_for()175 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}176 end177 wait_for {@driver.find_element(ACTIONS_PRINTEMAIL).displayed?}178 top_printemail = @driver.find_element(ACTIONS_PRINTEMAIL)179 top_printemail.click180 sleep(2)181 @driver.switch_to.frame(1)182 end183 def actions_makeinactive()184 def wait_for()185 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}186 end187 wait_for {@driver.find_element(ACTIONS_MAKEINACTIVE).displayed?}188 top_makeinactive = @driver.find_element(ACTIONS_MAKEINACTIVE)189 top_makeinactive.click190 end191 def search_patrol(searchname)192 def wait_for()193 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}194 end195 wait_for {@driver.find_element(SEARCH_FIELD).displayed?}196 patrol_search = @driver.find_element(SEARCH_FIELD)197 patrol_search.send_keys(searchname)198 def wait_for2()199 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}200 end201 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}202 search_confirm = @driver.find_element(SEARCH_BTN)203 search_confirm.click204 sleep(2)205 end206 def search_patrolid(searchname)207 def wait_for()208 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}209 end210 wait_for {@driver.find_element(ID_COLUMN).displayed?}211 patrol_search = @driver.find_element(ID_COLUMN)212 patrol_search.send_keys(searchname)213 sleep(3)214 end215 def search_patrolname(searchname)216 def wait_for()217 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}218 end219 wait_for {@driver.find_element(NAME_COLUMN).displayed?}220 patrol_search = @driver.find_element(NAME_COLUMN)221 patrol_search.send_keys(searchname)222 sleep(3)223 end224 def search_reset()225 def wait_for()226 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}227 end228 wait_for {@driver.find_element(RESET_BTN).displayed?}229 search_reset = @driver.find_element(RESET_BTN)230 search_reset.click231 sleep(2)232 end233 def grid_options()234 def wait_for()235 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}236 end237 wait_for {@driver.find_element(GRID_OPTIONS_DROPDOWN).displayed?}238 grid_options = @driver.find_element(GRID_OPTIONS_DROPDOWN)239 grid_options.click240 end241 def export_patrols()242 def wait_for()243 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}244 end245 wait_for {@driver.find_element(EXPORT_PATROLS).displayed?}246 export_patrols = @driver.find_element(EXPORT_PATROLS)247 export_patrols.click248 end249 def show_inactives()250 def wait_for()251 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}252 end253 wait_for {@driver.find_element(SHOW_INACTIVES).displayed?}254 show_inactives = @driver.find_element(SHOW_INACTIVES)255 show_inactives.click256 end257 def grid_total()258 gridtotal = @driver.find_element(GRID_TOTAL)259 end260 def resource_performance()261 navigationStart = driver.execute_script("return window.performance.timing.navigationStart")262 responseStart = driver.execute_script("return window.performance.timing.responseStart")263 domComplete = driver.execute_script("return window.performance.timing.domComplete")264 loadPerformance = domComplete - navigationStart265 def wait_for266 Selenium::WebDriver::Wait.new(:timeout => 20).until { yield }267 end268 wait_for {driver.find_element(GRID_TOTAL).text != "0 records" }269 patrols_records = driver.find_element(GRID_TOTAL)270 patrols_count = patrols_records.text271 print "Patrols: \n"272 print "%s \n" % patrols_count273 print "Load Time: %s ms \n\n" % loadPerformance274 end275 #CSS Methods: Popup276 def submitted_name(submittedname)277 submitted_name = @driver.find_element(SUBMITTED_NAME_FIELD)278 submitted_name.send_keys(submittedname)279 end280 def location(locationselect)281 dropdown_list = @driver.find_element(LOCATION_DROPDOWN)282 options = dropdown_list.find_elements(tag_name: 'option')283 options.each {|option| option.click if option.text == (locationselect)}284 end285 def service_needed(serviceneeded)286 service_needed = @driver.find_element(SERVICE_NEEDED_FIELD)287 service_needed.send_keys(serviceneeded)288 end289 def account_executive(accountexecutive)290 dropdown_list = @driver.find_element(ACCOUNT_EXECUTIVE_DROPDOWN)291 options = dropdown_list.find_elements(tag_name: 'option')292 options.each {|option| option.click if option.text == (accountexecutive)}293 end294 def bad_patrol_type(badpatroltype)295 dropdown_list = @driver.find_element(BAD_PATROL_TYPE_DROPDOWN)296 options = dropdown_list.find_elements(tag_name: 'option')297 options.each {|option| option.click if option.text == (badpatroltype)}298 end299 def date_completed(datecompleted)300 date_completed = @driver.find_element(DATE_COMPLETED_FIELD)301 date_completed.send_keys(datecompleted)302 end303 def customer(customer)304 customer_enter = @driver.find_element(CUSTOMER_FIELD)305 customer_enter.send_keys(customer)306 sleep(1)307 @driver.action.send_keys(:enter).perform308 end309 def cancel()310 def wait_for()311 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}312 end313 wait_for {@driver.find_element(CANCEL_BTN).displayed?}314 cancel_popup = @driver.find_element(CANCEL_BTN)315 cancel_popup.click316 end317 def actions()318 #Use actions_(action) methods from here319 def wait_for()320 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}321 end322 wait_for {@driver.find_element(ACTIONS_BTN).displayed?}323 actions_popup = @driver.find_element(ACTIONS_BTN)324 actions_popup.click325 end326 def save()327 def wait_for()328 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}329 end330 wait_for {@driver.find_element(SAVE_BTN).displayed?}331 save = @driver.find_element(SAVE_BTN)332 save.click333 end334 def save_close()335 def wait_for()336 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}337 end338 wait_for {@driver.find_element(SAVE_AND_CLOSE_BTN).displayed?}339 save_and_close = @driver.find_element(SAVE_AND_CLOSE_BTN)340 save_and_close.click341 sleep(2)342 end343 #CSS Methods: Popup (Contact Info Tab)344 def contact_info_tab()345 def wait_for()346 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}347 end348 wait_for {@driver.find_element(CONTACT_INFO_TAB).displayed?}349 contact_info_tab = @driver.find_element(CONTACT_INFO_TAB)350 contact_info_tab.click351 end352 def site_name(sitename)353 def wait_for()354 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}355 end356 wait_for {@driver.find_element(NAME_FIELD).displayed?}357 sitename_field = @driver.find_element(NAME_FIELD)358 sitename_field.send_keys(sitename)359 end360 def site_street(sitestreet)361 def wait_for()362 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}363 end364 wait_for {@driver.find_element(STREET_FIELD).displayed?}365 sitestreet_field = @driver.find_element(STREET_FIELD)366 sitestreet_field.send_keys(sitestreet)367 end368 def site_state(sitestate)369 def wait_for()370 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}371 end372 wait_for {@driver.find_element(STATE_FIELD).displayed?}373 sitestate_field = @driver.find_element(STATE_FIELD)374 sitestate_field.send_keys(sitestate)375 end376 def site_zip(sitezip)377 def wait_for()378 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}379 end380 wait_for {@driver.find_element(POSTAL_CODE_FIELD).displayed?}381 sitezip_field = @driver.find_element(POSTAL_CODE_FIELD)382 sitezip_field.send_keys(sitezip)383 end384 def site_country(sitecountry)385 def wait_for()386 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}387 end388 wait_for {@driver.find_element(COUNTRY_FIELD).displayed?}389 sitecountry_field = @driver.find_element(COUNTRY_FIELD)390 sitecountry_field.send_keys(sitecountry)391 end392 #If Customer is not linked (Otherwise use Class - Contacts Resource)393 def unlinked_contact_name(unlinkedcontactname)394 def wait_for()395 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}396 end397 wait_for {@driver.find_element(UNLINKED_CONTACT_NAME).displayed?}398 inputfield = @driver.find_element(UNLINKED_CONTACT_NAME)399 inputfield.send_keys(unlinkedcontactname)400 end401 def unlinked_contact_phone(unlinkedcontactphone)402 def wait_for()403 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}404 end405 wait_for {@driver.find_element(UNLINKED_CONTACT_PHONE).displayed?}406 inputfield = @driver.find_element(UNLINKED_CONTACT_PHONE)407 inputfield.send_keys(unlinkedcontactphone)408 end409 def unlinked_contact_email(unlinkedcontactemail)410 def wait_for()411 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}412 end413 wait_for {@driver.find_element(UNLINKED_CONTACT_EMAIL).displayed?}414 inputfield = @driver.find_element(UNLINKED_CONTACT_EMAIL)415 inputfield.send_keys(unlinkedcontactemail)416 end417 #CSS Methods: Popup (Activities Tab)418 def activities_tab()419 def wait_for()420 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}421 end422 wait_for {@driver.find_element(ACTIVITIES_TAB).displayed?}423 activities_tab = @driver.find_element(ACTIVITIES_TAB)424 activities_tab.click425 end426 def search_activity(searchactivity)427 def wait_for()428 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}429 end430 wait_for {@driver.find_element(SEARCH_ACTIVITY).displayed?}431 activity_search = @driver.find_element(SEARCH_ACTIVITY)432 activity_search.send_keys(searchname)433 def wait_for2()434 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}435 end436 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}437 search_confirm = @driver.find_element(SEARCH_BTN)438 search_confirm.click439 sleep(1)440 end441 def top_activitydescription()442 top_activitydescription = @driver.find_element(TOP_ACTIVITY_DESCRIPTION)443 end444 #CSS Methods: Popup (Estimates Tab)445 def estimates_tab()446 def wait_for()447 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}448 end449 wait_for {@driver.find_element(ESTIMATES_TAB).displayed?}450 estimates_tab = @driver.find_element(ESTIMATES_TAB)451 estimates_tab.click452 end453 def search_estimate(searchestimate)454 def wait_for()455 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}456 end457 wait_for {@driver.find_element(SEARCH_ESTIMATE).displayed?}458 estimate_search = @driver.find_element(SEARCH_ESTIMATE)459 estimate_search.send_keys(searchestimate)460 def wait_for2()461 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}462 end463 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}464 search_confirm = @driver.find_element(SEARCH_BTN)465 search_confirm.click466 sleep(1)467 end468 #CSS Methods: Popup (Jobs Tab)469 def jobs_tab()470 def wait_for()471 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}472 end473 wait_for {@driver.find_element(JOBS_TAB).displayed?}474 jobs_tab = @driver.find_element(JOBS_TAB)475 jobs_tab.click476 end477 def search_job(searchjob)478 def wait_for()479 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}480 end481 wait_for {@driver.find_element(SEARCH_JOB).displayed?}482 job_search = @driver.find_element(SEARCH_JOB)483 job_search.send_keys(searchjob)484 def wait_for2()485 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}486 end487 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}488 search_confirm = @driver.find_element(SEARCH_BTN)489 search_confirm.click490 sleep(1)491 end492end...

Full Screen

Full Screen

Class - Contacts Resource.rb

Source:Class - Contacts Resource.rb Github

copy

Full Screen

...59 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}60 end61 wait_for {@driver.find_element(CREATE_CONTACT_BTN).displayed?}62 create_contact = @driver.find_element(CREATE_CONTACT_BTN)63 create_contact.click64 sleep(3)65 @driver.switch_to.frame(0)66 end67 def top()68 top_contact = @driver.find_element(TOP_CONTACT)69 end70 def top_refnumber()71 top_refnumber = @driver.find_element(TOP_REFNUMBER)72 end73 def top_open()74 top_refnumber = @driver.find_element(TOP_REFNUMBER)75 top_refnumber.click76 sleep(2)77 @driver.switch_to.frame(0)78 end79 def top_actions()80 top_contactactions = @driver.find_element(TOP_CONTACT_ACTIONS)81 top_contactactions.click82 end83 def top_documents()84 def wait_for()85 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}86 end87 wait_for {@driver.find_element(TOP_CONTACT_DOCUMENTS).displayed?}88 top_documents = @driver.find_element(TOP_CONTACT_DOCUMENTS)89 top_documents.click90 end91 def top_inactive()92 def wait_for()93 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}94 end95 wait_for {@driver.find_element(TOP_CONTACT_INACTIVE).displayed?}96 top_makeinactive = @driver.find_element(TOP_CONTACT_INACTIVE)97 top_makeinactive.click98 end99 def search_contact(searchname)100 def wait_for()101 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}102 end103 wait_for {@driver.find_element(SEARCH_FIELD).displayed?}104 contact_name = @driver.find_element(SEARCH_FIELD)105 contact_name.send_keys(searchname)106 end107 def search_confirm()108 def wait_for()109 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}110 end111 wait_for {@driver.find_element(SEARCH_BTN).displayed?}112 search_confirm = @driver.find_element(SEARCH_BTN)113 search_confirm.click114 sleep(1)115 end116 def search_reset()117 def wait_for()118 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}119 end120 wait_for {@driver.find_element(RESET_BTN).displayed?}121 search_reset = @driver.find_element(RESET_BTN)122 search_reset.click123 end124 def grid_options()125 def wait_for()126 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}127 end128 wait_for {@driver.find_element(GRID_OPTIONS_DROPDOWN).displayed?}129 grid_options = @driver.find_element(GRID_OPTIONS_DROPDOWN)130 grid_options.click131 end132 def export_contacts()133 def wait_for()134 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}135 end136 wait_for {@driver.find_element(EXPORT_CONTACTS).displayed?}137 export_contacts = @driver.find_element(EXPORT_CONTACTS)138 export_contacts.click139 end140 def find_duplicates()141 def wait_for()142 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}143 end144 wait_for {@driver.find_element(FIND_DUPLICATES).displayed?}145 find_duplicates = @driver.find_element(FIND_DUPLICATES)146 find_duplicates.click147 end148 def show_inactives()149 def wait_for()150 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}151 end152 wait_for {@driver.find_element(SHOW_INACTIVES_CHECKBOX).displayed?}153 show_inactives = @driver.find_element(SHOW_INACTIVES_CHECKBOX)154 show_inactives.click155 end156 #Class Methods: Popup157 def contact_name(contactname)158 def wait_for()159 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}160 end161 wait_for {@driver.find_element(CONTACT_NAME_FIELD).displayed?}162 contact_name = @driver.find_element(CONTACT_NAME_FIELD)163 contact_name.send_keys(contactname)164 end165 def add_phone()166 def wait_for()167 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}168 end169 wait_for {@driver.find_element(ADD_PHONE_OPTN).displayed?}170 add_phone = @driver.find_element(ADD_PHONE_OPTN)171 add_phone.click172 end173 def contact_phone1(contactphone1)174 def wait_for()175 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}176 end177 wait_for {@driver.find_element(CONTACT_PHONE_FIRST).displayed?}178 phone_field = @driver.find_element(CONTACT_PHONE_FIRST)179 phone_field.send_keys(contactphone1)180 end181 def contact_phone2(contactphone2)182 def wait_for()183 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}184 end185 wait_for {@driver.find_element(CONTACT_PHONE_SECOND).displayed?}186 phone_field = @driver.find_element(CONTACT_PHONE_SECOND)187 phone_field.send_keys(contactphone2)188 end189 def contact_phone3(contactphone3)190 def wait_for()191 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}192 end193 wait_for {@driver.find_element(CONTACT_PHONE_THIRD).displayed?}194 phone_field = @driver.find_element(CONTACT_PHONE_THIRD)195 phone_field.send_keys(contactphone3)196 end197 def add_email198 def wait_for()199 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}200 end201 wait_for {@driver.find_element(ADD_EMAIL_OPTN).displayed?}202 add_email = @driver.find_element(ADD_EMAIL_OPTN)203 add_email.click204 end205 def contact_email1(contactemail1)206 def wait_for()207 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}208 end209 wait_for {driver.find_element(CONTACT_EMAIL_FIRST).displayed?}210 email_field = @driver.find_element(CONTACT_EMAIL_FIRST)211 email_field.send_keys(contactemail1)212 end213 def contact_email2(contactemail2)214 def wait_for()215 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}216 end217 wait_for {@driver.find_element(CONTACT_EMAIL_SECOND).displayed?}218 email_field = @driver.find_element(CONTACT_EMAIL_SECOND)219 email_field.send_keys(contactemail2)220 end221 def contact_email3(contactemail3)222 def wait_for()223 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}224 end225 wait_for {@driver.find_element(CONTACT_EMAIL_THIRD).displayed?}226 email_field = @driver.find_element(CONTACT_EMAIL_THIRD)227 email_field.send_keys(contactemail3)228 end229 def contact_notes(contactnotes)230 def wait_for()231 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}232 end233 wait_for {@driver.find_element(CONTACT_NOTES_FIELD).displayed?}234 contact_notes = @driver.find_element(CONTACT_NOTES_FIELD)235 contact_notes.send_keys(contactnotes)236 end237 def cancel()238 def wait_for()239 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}240 end241 wait_for {@driver.find_element(CANCEL_BTN).displayed?}242 cancel_popup = @driver.find_element(CANCEL_BTN)243 cancel_popup.click244 end245 def actions()246 def wait_for()247 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}248 end249 wait_for {@driver.find_element(ACTIONS_BTN).displayed?}250 actions_popup = @driver.find_element(ACTIONS_BTN)251 actions_popup.click252 end253 def inactive_popup254 def wait_for()255 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}256 end257 wait_for {@driver.find_element(POPUP_INACTIVE).displayed?}258 inactive_popup = @driver.find_element(POPUP_INACTIVE)259 inactive_popup.click260 def wait_for2()261 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}262 end263 wait_for2 {@driver.find_element(POPUP_CONFIRM_INACTIVE).displayed?}264 confirm_inactive = @driver.find_element(POPUP_CONFIRM_INACTIVE)265 confirm_inactive.click266 end267 def save_close()268 def wait_for()269 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}270 end271 wait_for {@driver.find_element(SAVE_AND_CLOSE_BTN).displayed?}272 save_and_close = @driver.find_element(SAVE_AND_CLOSE_BTN)273 save_and_close.click274 sleep(2)275 end276 #CSS Modifiers: Contacts Section (Resource Popups)277 def search_contacts_tab(searchname)278 def wait_for()279 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}280 end281 wait_for {@driver.find_element(CONTACTS_SEARCH_FIELD).displayed?}282 contact_name = @driver.find_element(CONTACTS_SEARCH_FIELD)283 contact_name.send_keys(searchname)284 sleep(1)285 button = @driver.find_element(SEARCH_CONTACTS_BTN)286 button.click287 end288 def reset_contacts_search()289 button = @driver.find_element(RESET_CONTACTS_BTN)290 button.click291 end292 def show_inactive_contacts()293 def wait_for()294 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}295 end296 wait_for {@driver.find_element(SHOW_INACTIVE_CONTACTS).displayed?}297 top_makeinactive = @driver.find_element(SHOW_INACTIVE_CONTACTS)298 top_makeinactive.click299 end300 def add_contact_button()301 def wait_for()302 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}303 end304 wait_for {@driver.find_element(ADD_BTN).displayed?}305 button = @driver.find_element(ADD_BTN)306 button.click307 sleep(4)308 @driver.switch_to.frame(1)309 end310 def link_contact_button()311 def wait_for()312 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}313 end314 wait_for {@driver.find_element(LINK_BTN).displayed?}315 button = @driver.find_element(LINK_BTN)316 button.click317 sleep(2)318 @driver.switch_to.frame(1)319 end320 def first_contact_name()321 display = @driver.find_element(FIRST_CONTACT_NAME)322 end323 def first_contact_notes()324 display = @driver.find_element(FIRST_CONTACT_NOTES)325 end326 def first_billing_checkbox()327 def wait_for()328 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}329 end330 wait_for {@driver.find_element(FIRST_BILLING_CHKBX).displayed?}331 checkbox = @driver.find_element(FIRST_BILLING_CHKBX)332 checkbox.click333 sleep(1)334 end335 def first_site_checkbox()336 def wait_for()337 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}338 end339 wait_for {@driver.find_element(FIRST_SITE_CHKBX).displayed?}340 checkbox = @driver.find_element(FIRST_SITE_CHKBX)341 checkbox.click342 sleep(1)343 end344 def second_contact_name()345 display = @driver.find_element(SECOND_CONTACT_NAME)346 end347 def second_contact_notes()348 display = @driver.find_element(SECOND_CONTACT_NOTES)349 end350 def second_billing_checkbox()351 def wait_for()352 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}353 end354 wait_for {@driver.find_element(SECOND_BILLING_CHKBX).displayed?}355 checkbox = @driver.find_element(SECOND_BILLING_CHKBX)356 checkbox.click357 sleep(1)358 end359 def second_site_checkbox()360 def wait_for()361 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}362 end363 wait_for {@driver.find_element(SECOND_SITE_CHKBX).displayed?}364 checkbox = @driver.find_element(SECOND_SITE_CHKBX)365 checkbox.click366 sleep(1)367 end368 def remove_top_contact()369 def wait_for()370 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}371 end372 wait_for {@driver.find_element(REMOVE_TOP_CONTACT).displayed?}373 button = @driver.find_element(REMOVE_TOP_CONTACT)374 button.click375 end376 #CSS Modifiers: Link Contact Popup377 def link_contact(searchname)378 def wait_for()379 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}380 end381 wait_for {@driver.find_element(LINK_CONTACT_SEARCH).displayed?}382 contact_name = @driver.find_element(LINK_CONTACT_SEARCH)383 contact_name.send_keys(searchname)384 sleep(1)385 @driver.action.send_keys(:enter).perform386 button = @driver.find_element(CONFIRM_LINK_BTN)387 button.click388 sleep(2)389 @driver.switch_to.frame(0)390 end391 def cancel_link_contact()392 def wait_for()393 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}394 end395 wait_for {@driver.find_element(CANCEL_LINK_BTN).displayed?}396 button = @driver.find_element(CANCEL_LINK_BTN)397 button.click398 sleep(2)399 @driver.switch_to.frame(0)400 end401end...

Full Screen

Full Screen

Class - Activities Resource.rb

Source:Class - Activities Resource.rb Github

copy

Full Screen

...46 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}47 end48 wait_for {@driver.find_element(ACTIVITIES_OPTN).displayed?}49 actions = @driver.find_element(ACTIVITIES_OPTN)50 actions.click51 def wait_for2()52 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}53 end54 wait_for2 {driver.find_element(class: "Counter_Message").text != "0 records"}55 end56 def activity_count()57 top_refnumber = @driver.find_element(ACTIVITIES_COUNT)58 end59 def top_refnumber()60 top_refnumber = @driver.find_element(TOP_REFNUMBER)61 end62 def top_description()63 top = @driver.find_element(TOP_DESCRIPTION)64 end65 def top_created()66 top = @driver.find_element(TOP_CREATED)67 end68 def top_created_date()69 top = @driver.find_element(TOP_CREATED_DATE)70 end71 def top_assigned()72 top = @driver.find_element(TOP_ASSIGNED)73 end74 def top_due()75 top = @driver.find_element(TOP_DUE)76 end77 def top_actions()78 def wait_for()79 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}80 end81 wait_for {@driver.find_element(TOP_ACTIVITY_ACTIONS).displayed?}82 top_actions = @driver.find_element(TOP_ACTIVITY_ACTIONS)83 top_actions.click84 end85 def actions_complete()86 def wait_for()87 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}88 end89 wait_for {@driver.find_element(ACTIONS_COMPLETE).displayed?}90 top_complete = @driver.find_element(ACTIONS_COMPLETE)91 top_complete.click92 end93 def actions_documents()94 def wait_for()95 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}96 end97 wait_for {@driver.find_element(ACTIONS_DOCUMENTS).displayed?}98 top_documents = @driver.find_element(ACTIONS_DOCUMENTS)99 top_documents.click100 sleep(2)101 @driver.switch_to.frame(0)102 end103 def actions_makeinactive()104 def wait_for()105 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}106 end107 wait_for {@driver.find_element(ACTIONS_MAKEINACTIVE).displayed?}108 top_makeinactive = @driver.find_element(ACTIONS_MAKEINACTIVE)109 top_makeinactive.click110 end111 def top_open()112 def wait_for()113 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}114 end115 wait_for {@driver.find_element(TOP_REFNUMBER).displayed?}116 top = @driver.find_element(TOP_REFNUMBER)117 top.click118 sleep(2)119 @driver.switch_to.frame(0)120 end121 def search_activity(searchname)122 def wait_for()123 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}124 end125 wait_for {@driver.find_element(SEARCH_FIELD).displayed?}126 activity_search = @driver.find_element(SEARCH_FIELD)127 activity_search.send_keys(searchname)128 def wait_for2()129 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}130 end131 wait_for2 {@driver.find_element(SEARCH_BTN).displayed?}132 search_confirm = @driver.find_element(SEARCH_BTN)133 search_confirm.click134 sleep(1)135 end136 def search_reset()137 def wait_for()138 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}139 end140 wait_for {@driver.find_element(RESET_BTN).displayed?}141 search_reset = @driver.find_element(RESET_BTN)142 search_reset.click143 end144 def create_activity()145 def wait_for()146 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}147 end148 wait_for {@driver.find_element(CREATE_ACTIVITY).displayed?}149 button = @driver.find_element(CREATE_ACTIVITY)150 button.click151 sleep(2)152 @driver.switch_to.frame(0)153 end154 def grid_options()155 def wait_for()156 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}157 end158 wait_for {@driver.find_element(GRID_OPTIONS_DROPDOWN).displayed?}159 grid_options = @driver.find_element(GRID_OPTIONS_DROPDOWN)160 grid_options.click161 end162 def export_activities()163 def wait_for()164 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}165 end166 wait_for {@driver.find_element(EXPORT_ACTIVITIES).displayed?}167 export_activities = @driver.find_element(EXPORT_ACTIVITIES)168 export_activities.click169 end170 def show_inactives()171 def wait_for()172 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}173 end174 wait_for {@driver.find_element(SHOW_INACTIVES).displayed?}175 show_inactives = @driver.find_element(SHOW_INACTIVES)176 show_inactives.click177 end178 def search_activityid(searchname)179 def wait_for()180 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}181 end182 wait_for {@driver.find_element(ID_COLUMN).displayed?}183 activity_search = @driver.find_element(ID_COLUMN)184 activity_search.send_keys(searchname)185 sleep(3)186 end187 def search_activitydescription(searchname)188 def wait_for()189 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}190 end191 wait_for {@driver.find_element(DESCRIPTION_COLUMN).displayed?}192 activity_search = @driver.find_element(DESCRIPTION_COLUMN)193 activity_search.send_keys(searchname)194 sleep(3)195 end196 def resource_performance()197 navigationStart = driver.execute_script("return window.performance.timing.navigationStart")198 responseStart = driver.execute_script("return window.performance.timing.responseStart")199 domComplete = driver.execute_script("return window.performance.timing.domComplete")200 loadPerformance = domComplete - navigationStart201 def wait_for202 Selenium::WebDriver::Wait.new(:timeout => 20).until { yield }203 end204 wait_for {driver.find_element(class: "Counter_Message").text != "0 records" }205 activity_records = driver.find_element(class: "Counter_Message")206 activity_count = activity_records.text207 print "Activities: \n"208 print "%s \n" % activity_count209 print "Load Time: %s ms \n\n" % loadPerformance210 end211 #CSS Methods: Popup212 def resource_text()213 resourcetext = @driver.find_element(RESOURCE_TEXT)214 end215 def complete_activity()216 def wait_for()217 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}218 end219 wait_for {@driver.find_element(COMPLETE_CHECKBOX).displayed?}220 checkbox = @driver.find_element(COMPLETE_CHECKBOX)221 checkbox.click222 end223 def complete_patrol()224 def wait_for()225 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}226 end227 wait_for {@driver.find_element(COMPLETE_PATROL_CHECKBOX).displayed?}228 checkbox = @driver.find_element(COMPLETE_PATROL_CHECKBOX)229 checkbox.click230 end231 def date_due_contents()232 textarea = @driver.find_element(DATE_DUE_FIELD)233 end234 def date_due(datedue)235 def wait_for()236 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}237 end238 wait_for {@driver.find_element(DATE_DUE_FIELD).displayed?}239 date_due = @driver.find_element(DATE_DUE_FIELD)240 date_due.send_keys(datedue)241 end242 def date_completed(datecompleted)243 def wait_for()244 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}245 end246 wait_for {@driver.find_element(DATE_COMPLETED_FIELD).displayed?}247 date_completed = @driver.find_element(DATE_COMPLETED_FIELD)248 date_completed.send_keys(datecompleted)249 end250 def date_reminder(datereminder)251 def wait_for()252 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}253 end254 wait_for {@driver.find_element(DATE_REMINDER_FIELD).displayed?}255 date_reminder = @driver.find_element(DATE_REMINDER_FIELD)256 date_reminder.send_keys(datereminder)257 end258 def reminder_emails(reminderemails)259 def wait_for()260 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}261 end262 wait_for {@driver.find_element(REMINDER_EMAILS_FIELD).displayed?}263 reminder_emails = @driver.find_element(REMINDER_EMAILS_FIELD)264 reminder_emails.send_keys(reminderemails)265 end266 def contact_method(typeselect)267 def wait_for()268 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}269 end270 wait_for {@driver.find_element(CONTACT_METHOD_DROPDOWN).displayed?}271 dropdown_list = @driver.find_element(CONTACT_METHOD_DROPDOWN)272 options = dropdown_list.find_elements(tag_name: 'option')273 options.each {|option| option.click if option.text == (typeselect)}274 end275 def reason(reasonselect)276 def wait_for()277 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}278 end279 wait_for {@driver.find_element(REASON_DROPDOWN).displayed?}280 dropdown_list = @driver.find_element(REASON_DROPDOWN)281 options = dropdown_list.find_elements(tag_name: 'option')282 options.each {|option| option.click if option.text == (reasonselect)}283 sleep(1)284 end285 def description(descriptionfield)286 def wait_for()287 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}288 end289 wait_for {@driver.find_element(DESCRIPTION_FIELD).displayed?}290 description = @driver.find_element(DESCRIPTION_FIELD)291 description.send_keys(descriptionfield)292 end293 def cancel()294 def wait_for()295 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}296 end297 wait_for {@driver.find_element(CANCEL_BTN).displayed?}298 cancel_popup = @driver.find_element(CANCEL_BTN)299 cancel_popup.click300 end301 def actions()302 #Use actions_(action) methods from here303 def wait_for()304 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}305 end306 wait_for {@driver.find_element(ACTIONS_BTN).displayed?}307 actions_popup = @driver.find_element(ACTIONS_BTN)308 actions_popup.click309 end310 def save_new()311 def wait_for()312 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}313 end314 wait_for {@driver.find_element(SAVE_AND_NEW_BTN).displayed?}315 save_and_new = @driver.find_element(SAVE_AND_NEW_BTN)316 save_and_new.click317 sleep(2)318 #@driver.switch_to.frame(0)319 end320 def save_close()321 def wait_for()322 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}323 end324 wait_for {@driver.find_element(SAVE_AND_CLOSE_BTN).displayed?}325 save_and_close = @driver.find_element(SAVE_AND_CLOSE_BTN)326 save_and_close.click327 sleep(2)328 @driver.switch_to.frame(0)329 @driver.execute_script("window.scrollTo(0, document.body.scrollHeight)")330 end331 def save_close_grid()332 def wait_for()333 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}334 end335 wait_for {@driver.find_element(SAVE_AND_CLOSE_BTN).displayed?}336 save_and_close = @driver.find_element(SAVE_AND_CLOSE_BTN)337 save_and_close.click338 sleep(2)339 end340end...

Full Screen

Full Screen

Class - Settings Page.rb

Source:Class - Settings Page.rb Github

copy

Full Screen

...43 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}44 end45 wait_for {@driver.find_element(SETTINGS_OPTN).displayed?}46 settings_button = @driver.find_element(SETTINGS_OPTN)47 settings_button.click48 end49 def open_activities()50 def wait_for()51 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}52 end53 wait_for {@driver.find_element(ACTIVITIES_OPTN).displayed?}54 activities_selection = @driver.find_element(ACTIVITIES_OPTN)55 activities_selection.click56 end57 def open_contacts()58 def wait_for()59 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}60 end61 wait_for {@driver.find_element(CONTACTS_OPTN).displayed?}62 contacts_selection = @driver.find_element(CONTACTS_OPTN)63 contacts_selection.click64 def wait_for2()65 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}66 end67 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }68 end69 def open_crews()70 crews_selection = @driver.find_element(CREWS_OPTN)71 crews_selection.click72 def wait_for2()73 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}74 end75 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }76 end77 def open_customerassets()78 customerassets_selection = @driver.find_element(CUSTOMERASSETS_OPTN)79 customerassets_selection.click80 end81 def open_employees()82 employees_selection = @driver.find_element(EMPLOYEES_OPTN)83 employees_selection.click84 def wait_for2()85 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}86 end87 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }88 end89 def open_documents()90 documents_selection = @driver.find_element(DOCUMENTS_OPTN)91 documents_selection.click92 def wait_for2()93 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}94 end95 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }96 end97 def open_timeentries()98 timeentries_selection = @driver.find_element(TIMEENTRIES_OPTN)99 timeentries_selection.click100 def wait_for2()101 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}102 end103 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }104 end105 def open_timesheets()106 timesheets_selection = @driver.find_element(TIMESHEETS_OPTN)107 timesheets_selection.click108 def wait_for2()109 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}110 end111 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }112 end113 def open_invoicelines()114 invoicelines_selection = @driver.find_element(INVOICELINES_OPTN)115 invoicelines_selection.click116 def wait_for2()117 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}118 end119 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }120 end121 def open_joblines()122 joblines_selection = @driver.find_element(JOBLINES_OPTN)123 joblines_selection.click124 def wait_for2()125 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}126 end127 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }128 end129 def open_productsandservices()130 productsandservices_selection = @driver.find_element(PRODUCTSANDSERVICES_OPTN)131 productsandservices_selection.click132 def wait_for2()133 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}134 end135 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }136 end137 def open_productcategories()138 productcategories_selection = @driver.find_element(PRODUCTCATEGORIES_OPTN)139 productcategories_selection.click140 end141 def open_announcements()142 announcements_selection = @driver.find_element(ANNOUNCEMENTS_OPTN)143 announcements_selection.click144 end145 def open_releasenotes()146 releasenotes_selection = @driver.find_element(RELEASENOTES_OPTN)147 releasenotes_selection.click148 def wait_for2()149 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}150 end151 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }152 end153 def open_royalties()154 royalties_selection = @driver.find_element(ROYALTIES_OPTN)155 royalties_selection.click156 end157 #CSS Methods: Lists158 def open_assetcategories()159 assetcategories_selection = @driver.find_element(ASSETCATEGORIES_OPTN)160 assetcategories_selection.click161 end162 def open_classes()163 classes_selection = @driver.find_element(CLASSES_OPTN)164 classes_selection.click165 def wait_for2()166 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}167 end168 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }169 end170 def open_paymentmethods()171 paymentmethods_selection = @driver.find_element(PAYMENTMETHODS_OPTN)172 paymentmethods_selection.click173 def wait_for2()174 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}175 end176 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }177 end178 def open_priceagreements()179 priceagreements_selection = @driver.find_element(PRICEAGREEMENTS_OPTN)180 priceagreements_selection.click181 def wait_for2()182 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}183 end184 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }185 end186 def open_terms()187 terms_selection = @driver.find_element(TERMS_OPTN)188 terms_selection.click189 def wait_for2()190 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}191 end192 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }193 end194 def open_trucks()195 trucks_selection = @driver.find_element(TRUCKS_OPTN)196 trucks_selection.click197 def wait_for2()198 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}199 end200 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }201 end202 def open_rmas()203 rmas_selection = @driver.find_element(RMAS_OPTN)204 rmas_selection.click205 end206 #CSS Methods: Setup207 def open_companysettings()208 companysettings_selection = @driver.find_element(COMPANYSETTINGS_OPTN)209 companysettings_selection.click210 end211 def open_chartofaccounts()212 chartofaccounts_selection = @driver.find_element(CHARTOFACCOUNTS_OPTN)213 chartofaccounts_selection.click214 end215 def open_departments()216 departments_selection = @driver.find_element(DEPARTMENTS_OPTN)217 departments_selection.click218 def wait_for2()219 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}220 end221 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }222 end223 def open_locations()224 locations_selection = @driver.find_element(LOCATIONS_OPTN)225 locations_selection.click226 def wait_for2()227 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}228 end229 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }230 end231 def open_paymentprocessing()232 paymentprocessing_selection = @driver.find_element(PAYMENTPROCESSING_OPTN)233 paymentprocessing_selection.click234 end235 def open_roles()236 roles_selection = @driver.find_element(ROLES_OPTN)237 roles_selection.click238 def wait_for2()239 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}240 end241 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }242 end243 def open_taxratesandagencies()244 taxrates_selection = @driver.find_element(TAXRATESANDAGENCIES_OPTN)245 taxrates_selection.click246 def wait_for2()247 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}248 end249 wait_for2 {@driver.find_element(class: "Counter_Message").text != "0 records" }250 end251end...

Full Screen

Full Screen

Class - PrintEmail Page.rb

Source:Class - PrintEmail Page.rb Github

copy

Full Screen

...36 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}37 end38 wait_for {@driver.find_element(PDF_CHECKBOX).displayed?}39 checkbox = @driver.find_element(PDF_CHECKBOX)40 checkbox.click41 end42 def include_images()43 def wait_for()44 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}45 end46 wait_for {@driver.find_element(IMAGES_CHECKBOX).displayed?}47 checkbox = @driver.find_element(IMAGES_CHECKBOX)48 checkbox.click49 end50 def completed_activity()51 def wait_for()52 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}53 end54 wait_for {@driver.find_element(COMPLETED_ACTIVITY_CHECKBOX).displayed?}55 checkbox = @driver.find_element(COMPLETED_ACTIVITY_CHECKBOX)56 checkbox.click57 end58 def remit_to()59 def wait_for()60 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}61 end62 wait_for {@driver.find_element(REMIT_TO_CHECKBOX).displayed?}63 checkbox = @driver.find_element(REMIT_TO_CHECKBOX)64 checkbox.click65 end66 def service_needed()67 def wait_for()68 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}69 end70 wait_for {@driver.find_element(SERVICE_NEEDED_CHECKBOX).displayed?}71 checkbox = @driver.find_element(SERVICE_NEEDED_CHECKBOX)72 checkbox.click73 end74 def include_lineitems()75 def wait_for()76 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}77 end78 wait_for {@driver.find_element(LINE_ITEMS_CHECKBOX).displayed?}79 checkbox = @driver.find_element(LINE_ITEMS_CHECKBOX)80 checkbox.click81 end82 def include_total()83 def wait_for()84 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}85 end86 wait_for {@driver.find_element(TOTAL_CHECKBOX).displayed?}87 checkbox = @driver.find_element(TOTAL_CHECKBOX)88 checkbox.click89 end90 def scope_of_work()91 def wait_for()92 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}93 end94 wait_for {@driver.find_element(SCOPE_OF_WORK_CHECKBOX).displayed?}95 checkbox = @driver.find_element(SCOPE_OF_WORK_CHECKBOX)96 checkbox.click97 end98 def invoice_special_instructions()99 def wait_for()100 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}101 end102 wait_for {@driver.find_element(INVOICE_SPECIAL_INSTRUCTIONS_CHECKBOX).displayed?}103 checkbox = @driver.find_element(INVOICE_SPECIAL_INSTRUCTIONS_CHECKBOX)104 checkbox.click105 end106 def estimate_special_instructions()107 def wait_for()108 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}109 end110 wait_for {@driver.find_element(ESTIMATE_SPECIAL_INSTRUCTIONS_CHECKBOX).displayed?}111 checkbox = @driver.find_element(ESTIMATE_SPECIAL_INSTRUCTIONS_CHECKBOX)112 checkbox.click113 end114 def job_special_instructions()115 def wait_for()116 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}117 end118 wait_for {@driver.find_element(JOB_SPECIAL_INSTRUCTIONS_CHECKBOX).displayed?}119 checkbox = @driver.find_element(JOB_SPECIAL_INSTRUCTIONS_CHECKBOX)120 checkbox.click121 end122 def additional_notes()123 def wait_for()124 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}125 end126 wait_for {@driver.find_element(ADDITIONAL_NOTES_CHECKBOX).displayed?}127 checkbox = @driver.find_element(ADDITIONAL_NOTES_CHECKBOX)128 checkbox.click129 end130 def invoice_customer_memo()131 def wait_for()132 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}133 end134 wait_for {@driver.find_element(INVOICE_CUSTOMER_MEMO_CHECKBOX).displayed?}135 checkbox = @driver.find_element(INVOICE_CUSTOMER_MEMO_CHECKBOX)136 checkbox.click137 end138 def cancel()139 def wait_for()140 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}141 end142 wait_for {@driver.find_element(CANCEL_BTN).displayed?}143 cancel_button = @driver.find_element(CANCEL_BTN)144 cancel_button.click145 sleep(2)146 @driver.switch_to.frame(0)147 end148 def ok()149 def wait_for()150 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}151 end152 wait_for {@driver.find_element(OK_BTN).displayed?}153 ok_button = @driver.find_element(OK_BTN)154 ok_button.click155 end156 #CSS Methods: Email Page157 def email_address(emailaddress)158 def wait_for()159 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}160 end161 wait_for {@driver.find_element(EMAIL_ADDRESS_FIELD).displayed?}162 email_address = @driver.find_element(EMAIL_ADDRESS_FIELD)163 email_address.send_keys(emailaddress)164 end165 def email_from(emailfrom)166 def wait_for()167 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}168 end169 wait_for {@driver.find_element(EMAIL_FROM_FIELD).displayed?}170 email_from = @driver.find_element(EMAIL_FROM_FIELD)171 email_from.send_keys(emailfrom)172 end173 def bcc_address(bccaddress)174 def wait_for()175 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}176 end177 wait_for {@driver.find_element(BCC_ADDRESS_FIELD).displayed?}178 bcc_address = @driver.find_element(BCC_ADDRESS_FIELD)179 bcc_address.send_keys(bccaddress)180 end181 def email_subject(emailsubject)182 def wait_for()183 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}184 end185 wait_for {@driver.find_element(EMAIL_SUBJECT_FIELD).displayed?}186 email_subject = @driver.find_element(EMAIL_SUBJECT_FIELD)187 email_subject.send_keys(emailsubject)188 end189 def email_message(emailmessage)190 field_click = @driver.find_element(EMAIL_MESSAGE_FIELD)191 field_click.click192 def wait_for()193 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}194 end195 wait_for {@driver.find_element(EMAIL_MESSAGE_FIELD).displayed?}196 email_message = @driver.find_element(EMAIL_MESSAGE_FIELD)197 email_message.send_keys(emailmessage)198 end199 def mailing()200 def wait_for()201 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}202 end203 wait_for {@driver.find_element(MAILING_CHECKBOX).displayed?}204 checkbox = @driver.find_element(MAILING_CHECKBOX)205 checkbox.click206 end207 def close()208 def wait_for()209 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}210 end211 wait_for {@driver.find_element(CLOSE_BTN).displayed?}212 close_button = @driver.find_element(CLOSE_BTN)213 close_button.click214 sleep(2)215 @driver.switch_to.frame(0)216 end217 def back()218 def wait_for()219 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}220 end221 wait_for {@driver.find_element(BACK_BTN).displayed?}222 back_button = @driver.find_element(BACK_BTN)223 back_button.click224 end225 def print()226 def wait_for()227 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}228 end229 wait_for {@driver.find_element(PRINT_BTN).displayed?}230 print_button = @driver.find_element(PRINT_BTN)231 print_button.click232 end233 def email_close()234 def wait_for()235 Selenium::WebDriver::Wait.new(:timeout => 5).until {yield}236 end237 wait_for {@driver.find_element(EMAIL_AND_CLOSE_BTN).displayed?}238 email_button = @driver.find_element(EMAIL_AND_CLOSE_BTN)239 email_button.click240 sleep(1)241 driver.switch_to.alert.accept rescue Selenium::WebDriver::Error::NoAlertOpenError242 sleep(3)243 @driver.switch_to.frame(0)244 end245end...

Full Screen

Full Screen

click

Using AI Code Generation

copy

Full Screen

1element = driver.find_element(:name, 'q')2driver.find_element(:link, 'Selenium WebDriver').click3element = driver.find_element(:name, 'q')4driver.find_element(:link, 'Selenium WebDriver').click5element = driver.find_element(:name, 'q')6driver.find_element(:link, 'Selenium WebDriver').click7element = driver.find_element(:name, 'q')8driver.find_element(:link, 'Selenium WebDriver').click9element = driver.find_element(:name, 'q')10driver.find_element(:link, 'Selenium WebDriver').click

Full Screen

Full Screen

click

Using AI Code Generation

copy

Full Screen

1element = driver.find_element(:name, 'q')2element = driver.find_element(:name, 'q')3element = driver.find_element(:name, 'q')4element = driver.find_element(:name, 'q')5element = driver.find_element(:name, 'q')6element = driver.find_element(:name, 'q')7element = driver.find_element(:name, 'q')

Full Screen

Full Screen

click

Using AI Code Generation

copy

Full Screen

1element = driver.find_element(:name, 'q')2driver.find_element(:link, 'Selenium - Web Browser Automation').click3element = driver.find_element(:name, 'q')4driver.find_element(:link, 'Selenium - Web Browser Automation').click5element = driver.find_element(:name, 'q')6driver.find_element(:link, 'Selenium - Web Browser Automation').click7element = driver.find_element(:name, 'q')8driver.find_element(:link, 'Selenium - Web Browser Automation').click9element = driver.find_element(:name, 'q')10driver.find_element(:link, 'Selenium - Web Browser Automation').click11element = driver.find_element(:name, 'q')

Full Screen

Full Screen

click

Using AI Code Generation

copy

Full Screen

1 @driver.get(@base_url + "/")2 @driver.find_element(:id, "gbqfq").clear3 @driver.find_element(:id, "gbqfq").send_keys "Test"4 @driver.find_element(:id, "gbqfb").click5 @driver.get(@base_url + "/")6 @driver.find_element(:link, "Gmail").click

Full Screen

Full Screen

click

Using AI Code Generation

copy

Full Screen

1 @driver.get(@base_url + "/")2 @driver.find_element(:id, "gbqfq").clear3 @driver.find_element(:id, "gbqfq").send_keys "Selenium"4 @driver.find_element(:id, "gbqfb").click

Full Screen

Full Screen

click

Using AI Code Generation

copy

Full Screen

1driver.find_element(:name, 'q').send_keys "Selenium WebDriver"2driver.find_element(:name, 'btnG').click3driver.find_element(:name, 'q').send_keys "Selenium WebDriver"4driver.find_element(:name, 'btnG').click

Full Screen

Full Screen

click

Using AI Code Generation

copy

Full Screen

1element = driver.find_element(:name, 'q')2driver.find_element(:link, 'Selenium WebDriver').click3element = driver.find_element(:name, 'q')4driver.find_element(:link, 'Selenium WebDriver').click5element = driver.find_element(:name, 'q')6driver.find_element(:link, 'Selenium WebDriver').click7element = driver.find_element(:name, 'q')8driver.find_element(:link, 'Selenium WebDriver').click9element = driver.find_element(:name, 'q')10driver.find_element(:link, 'Selenium WebDriver').click

Full Screen

Full Screen

click

Using AI Code Generation

copy

Full Screen

1element = driver.find_element(:name, 'q')2driver.find_element(:link, 'Selenium - Web Browser Automation').click3element = driver.find_element(:name, 'q')4driver.find_element(:link, 'Selenium - Web Browser Automation').click5element = driver.find_element(:name, 'q')6driver.find_element(:link, 'Selenium - Web Browser Automation').click7element = driver.find_element(:name, 'q')8driver.find_element(:link, 'Selenium - Web Browser Automation').click9element = driver.find_element(:name, 'q')10driver.find_element(:link, 'Selenium - Web Browser Automation').click11element = driver.find_element(:name, 'q')

Full Screen

Full Screen

click

Using AI Code Generation

copy

Full Screen

1 @driver.get(@base_url + "/")2 @driver.find_element(:id, "gbqfq").clear3 @driver.find_element(:id, "gbqfq").send_keys "Test"4 @driver.find_element(:id, "gbqfb").click5 @driver.get(@base_url + "/")6 @driver.find_element(:link, "Gmail").click

Full Screen

Full Screen

click

Using AI Code Generation

copy

Full Screen

1 @driver.get(@base_url + "/")2 @driver.find_element(:id, "gbqfq").clear3 @driver.find_element(:id, "gbqfq").send_keys "Selenium"4 @driver.find_element(:id, "gbqfb").click

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.

Run Selenium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful