from bs4 import BeautifulSoup


def get_one_page_urls(driver, url_prefix):
    """Takes a webdriver and an url_prefix as input,
       parses a webpage and returns a list of the urls of the books in that page

    Args:
        driver (selenium.webdriver): a webdriver pointing at a specific webpage
        url_prefix (str): prefix of the target books webpages

    Returns:
        [list]: list of all books' URLs in the current page
    """
    temp_urls_list = []
    
    # gets all books in the page
    page_source = BeautifulSoup(driver.page_source, features='lxml')
    urls_tag = page_source.find_all('a', class_='bookTitle')
    
    # iterates over each book and stores their URL
    for tag in urls_tag:
        temp_urls_list.append(url_prefix + tag.get('href'))
    return temp_urls_list