Exemplo n.º 1
0
 def setUp(self):
     try:
         self.driver = get_driver('firefox')
     except:
         self.driver = get_driver('chrome')
     self.driver.get(MAPSEARCH_INSTANCE_URL)
     display_javascript_notice(
         self.driver, "running test: {0}".format(self._testMethodName))
     wait_for_ajaxes_to_complete(self.driver)
 def setUp(self):
     sys.exc_clear()
     self.driver = get_driver(Settings.site_url)
     self.project_exists = False
     self.provider_exists = False
     self.resource_exists = False
     self.driver.implicitly_wait(BaseSettings.implicitly_wait)
Exemplo n.º 3
0
def get_article_urls_from_page_batch(urls:list):
    browser = get_driver()
    article_urls = []
    for page in urls:
        section_url = page['section_url']
        volume_number = page['volume']
        page_number = page['page_number']
        page_url = section_url + '/articles' + f'?tab=keyword&volume={volume_number}&sort=PubDateAscending&page={page_number}'
        print(f'Parsing page for articles {page_url}')
        if connect_to_base(browser, page_url):
            time.sleep(1)
            html = browser.page_source
            page_soup = BeautifulSoup(html, 'html.parser')
            article_tags = get_entry_aricle_a_tags_from_soup(page_soup)
            found_urls = [
                section_url + a['href']
                for a in article_tags
            ]
            article_urls.extend(found_urls)
        else:
            print(f'Error connectin to BMC - Article URL read for {page_url}')
            continue

    browser.quit()
    return article_urls
 def setUp(self):
     sys.exc_clear()
     self.driver = get_driver(Settings.site_url)
     self.project_exists = False
     self.resource_exists = False
     self.driver.implicitly_wait(BaseSettings.implicitly_wait)
     self.project_name = Settings.get_unique_attribute('project_name')
     self.resource_name = Settings.get_unique_attribute('resource_name')
Exemplo n.º 5
0
 def setUp(self):
     self.driver = get_driver()
     # 1)
     login_page = LoginPage(driver=self.driver, url=base_url)
     login_page.open()
     login_page.wait_for_loading()
     coll_page = login_page.login_with(credentials)
     self.page = coll_page
 def setUp(self):
     sys.exc_clear()
     self.driver = get_driver(Settings.site_url)
     self.project_exists = False
     self.resource_exists = False
     self.driver.implicitly_wait(BaseSettings.implicitly_wait)
     self.project_name = Settings.get_unique_attribute('project_name')
     self.resource_name = Settings.get_unique_attribute('resource_name')
Exemplo n.º 7
0
def driver():
    """Create the driver."""

    driver = get_driver()

    yield driver

    close_driver(driver)
Exemplo n.º 8
0
def get_section_urls():
    browser = get_driver()
    section_page_urls = []
    if connect_to_base(browser, BMC_JOURNAL_A_Z_URL):
        print('Parsing sections')
        time.sleep(1)
        html = browser.page_source
        section_soup = BeautifulSoup(html, 'html.parser')
        section_page_urls = get_section_urls_from_section_soup(section_soup)
    else:
        print('Error connecting to BMC - Sections read')

    browser.quit()
    return section_page_urls
Exemplo n.º 9
0
def run_get_page_articles_process_batch(urls):
    browser = get_driver()
    articles = []
    for url in urls:
        print(f'Parsing article {url}')
        if connect_to_base(browser, url):
            time.sleep(1)
            html = browser.page_source
            soup = BeautifulSoup(html, 'html.parser')
            article = process_article_for_soup(soup, url)
            articles.append(article)
        else:
            print('Error connecting to bmc')

    browser.quit()
    return articles
Exemplo n.º 10
0
def get_page_urls_from_section_batch(urls:list):
    browser = get_driver()
    page_urls = []
    for section_url in urls:
        print(f'Parsing 2019 volume from section {section_url}')
        volume_number = None
        if connect_to_base(browser, section_url + "/articles"):
            time.sleep(1)
            html = browser.page_source
            section_soup = BeautifulSoup(html, 'html.parser')
            volume_number = get_2019_volume_number(section_soup)
        else:
            print(f'Error connectin to BMC - Volume read for {section_urls}')
            continue

        if connect_to_base(browser, section_url + '/articles'+ f'?tab=keyword&volume={volume_number}&sort=PubDateAscending'):
            time.sleep(1)
            html = browser.page_source
            first_page_soup = BeautifulSoup(html, 'html.parser')
            number_of_pages = get_number_of_pages(first_page_soup)
            if number_of_pages is None:
                print(f'Error reading number of pages for {section_urls} volume {volume_number}')
                print(f'Retry!!!')
                break
            section_pages_urls = [
                {
                    'section_url': section_url,
                    'volume': {volume_number},
                    'page_number': {page_num}
                }
                for page_num 
                in range(1, number_of_pages+1)
            ]
            page_urls.extend(section_pages_urls)
        else:
            print(f'Error connectin to BMC - Page number read for {section_urls} volume {volume_number}')
            continue

    browser.quit()
    return page_urls
 def setUp(self):
     self.driver = get_driver(Settings.site_url)
     self.project_exists = False
     self.ssh_key_exists = False
     self.resource_exists = False
     self.driver.implicitly_wait(BaseSettings.implicitly_wait)
 def setUp(self):
     sys.exc_clear()
     self.driver = get_driver(Settings.site_url)
     self.organization_exists = False
     self.driver.implicitly_wait(BaseSettings.implicitly_wait)
     self.organization = Settings.get_unique_attribute('organization')
Exemplo n.º 13
0
 def setUp(self):
     sys.exc_clear()
     self.driver = get_driver(Settings.site_url)
     self.organization_exists = False
     self.driver.implicitly_wait(BaseSettings.implicitly_wait)
     self.organization = Settings.get_unique_attribute('organization')
 def setUp(self):
     self.driver = get_driver(Settings.site_url)
     self.project_exists = False
     self.provider_exists = False
     self.resource_exists = False
     self.driver.implicitly_wait(BaseSettings.implicitly_wait)
Exemplo n.º 15
0
 def setUp(self):
     # Get the driver instance
     self.driver = helpers.get_driver()
 def setUp(self):
     self.driver = get_driver(Settings.site_url)
     self.project_exists = False
     self.application_group_exists = False
     self.application_project_exists = False
     self.driver.implicitly_wait(BaseSettings.implicitly_wait)