Exemplo n.º 1
0
def budget_login(url, browser_type):
    """
    Keyword to Launch the budget site
    :param url:
    :param user_name:
    :param password:
    :return:
    """
    global invoker
    retry_count = 0
    invoker = BUDGET()
    invoker.initialize_driver(browser_type)

    try:
        while retry_count < 3:
            retry_count = retry_count + 1
            invoker.driver.get(url)
            invoker.driver.implicitly_wait(30)
            icons_status = invoker.driver.find_element_by_xpath(budget_icon)
            button_status = invoker.driver.find_element_by_xpath(
                WEB_ELEMENT_SELECT_CAR)
            if icons_status.is_displayed() and button_status.is_enabled():
                return True
            else:
                time.sleep(20)
                if retry_count > 3:
                    raise Exception
    except Exception as err:
        raise RemoteError("issue in launching Budget Site")
Exemplo n.º 2
0
 def run_keyword(self, name, args):
     args = [ self._handle_argument(arg) for arg in args ]
     result = RemoteResult(self._client.run_keyword(name, args))
     sys.stdout.write(result.output)
     if result.status != 'PASS':
         raise RemoteError(result.error, result.traceback)
     return result.return_
Exemplo n.º 3
0
def select_a_car():
    """
    Keyword to select a car
    :return:
    """
    try:
        invoker.driver.find_element_by_xpath(BUTTON_CLICK_CAR).click()
    except Exception as err:
        raise RemoteError("Issue in selecting a car")
Exemplo n.º 4
0
 def run_keyword(self, name, args, kwargs):
     coercer = ArgumentCoercer()
     args = coercer.coerce(args)
     kwargs = coercer.coerce(kwargs)
     result = RemoteResult(self._client.run_keyword(name, args, kwargs))
     sys.stdout.write(result.output)
     if result.status != 'PASS':
         raise RemoteError(result.error, result.traceback, result.fatal,
                           result.continuable)
     return result.return_
Exemplo n.º 5
0
def select_pick_up_date():
    """
    Method to select pickupdate
    :return:
    """
    try:
        pick_up_date = invoker.selct_pick_up_date_fpr_journey()
        return pick_up_date
    except Exception as err:
        raise RemoteError("Issue in getting the pickup date")
Exemplo n.º 6
0
def close_browser():
    """
    Keyword to close browser
    :return: N/A
    """
    try:
        invoker.driver.close()
        invoker.driver.quit()
    except Exception as err:
        raise RemoteError("Issue in closing the browser")
Exemplo n.º 7
0
def select_return_date(pick_up_date):
    """
    Method to select return date
    :param pick_up_date:
    :return:
    """
    try:
        return_date = invoker.select_return_date_for_journey(pick_up_date)
        return return_date
    except Exception as err:
        raise RemoteError("Issue in selecting  return date")
Exemplo n.º 8
0
def validate_selected_details(start_location, send_location, vehicle_name):

    try:
        estimated_total = invoker.validate_details_rental_options_page(
            start_location, send_location, vehicle_name)
        if estimated_total is False:
            raise Exception
        else:
            return estimated_total
    except Exception as err:
        raise RemoteError("Issue in validating the details in rental options")
Exemplo n.º 9
0
def select_vehicle_type(car_type):
    """
    Keyword to select a vehicle type based on the input
    :return:
    """
    try:
        selected_vehicl_name = invoker.select_car_type(car_type)
        if selected_vehicl_name is False:
            raise Exception
        else:
            return selected_vehicl_name
    except Exception as err:
        raise RemoteError("Issue in selecting a car type")
Exemplo n.º 10
0
 def run_keyword(self, name, args, kwargs):
     response = self.s.post(
         f"{self.url}/run_keyword",
         data=dumps({
             "name": name,
             "args": args,
             "kwargs": kwargs
         }),
         headers={"Content-Type": "application/octet-stream"},
     )
     result = RemoteResult(**loads(response.content))
     sys.stdout.write(result.output)
     if result.status != "PASS":
         raise RemoteError(result.error, result.traceback, result.fatal,
                           result.continuable)
     return result.return_
Exemplo n.º 11
0
def select_locattion(location):
    """
    Keyword to select location
    :param location: <string> location tobe selected
    :return:
    """
    try:
        location_value = invoker.select_location(location)
        if location_value is not False:
            return location_value
        else:
            raise Exception
    except Exception as err:
        raise RemoteError("Issue in selecting location",
                          fatal=False,
                          continuable=False)
Exemplo n.º 12
0
 def initialize_driver(self,browser_type):
     try:
         if browser_type is "Chrome":
             self.driver = webdriver.Chrome(executable_path= self._chromedriver, chrome_options= self._options)
     except Exception as err:
         raise RemoteError ("Issue in initializung browser",fatal=False, continuable=False)