Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion help_docs/features_list.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<a id="feature_list"></a>
### ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") **SeleniumBase Features:**
* A versatile test automation framework for building & running Selenium scripts reliably.
* A complete test automation framework for building & running reliable testing scripts.
* Uses [Pytest](https://docs.pytest.org/en/latest/) and [Nose](http://nose.readthedocs.io/en/latest/) runners for test discovery, organization, execution, and logging.
* Includes [console scripts](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/console_scripts/ReadMe.md) that save you time by installing web drivers automatically, etc.
* Includes a [website tour builder](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md) for creating and running walkthroughs on any website.
Expand Down
2 changes: 2 additions & 0 deletions help_docs/method_summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ self.download_file(file_url, destination_folder=None)

self.save_file_as(file_url, new_file_name, destination_folder=None)

self.save_data_as(data, file_name, destination_folder=None)

self.get_downloads_folder(file)

self.get_path_of_downloaded_file(file)
Expand Down
14 changes: 12 additions & 2 deletions seleniumbase/fixtures/base_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,8 @@ def play_tour(self, name=None, interval=0):
selector = re.search(
"[\S\s]+{element: '([\S\s]+)', on: [\S\s]+",
self._tour_steps[name][1]).group(1)
self.__wait_for_css_query_selector(
selector = selector.replace('\\', '')
self.wait_for_element_present(
selector, timeout=(settings.SMALL_TIMEOUT))
except Exception:
self.__post_messenger_error_message(
Expand Down Expand Up @@ -1614,7 +1615,8 @@ def safe_execute_script(self, script):

def download_file(self, file_url, destination_folder=None):
""" Downloads the file from the url to the destination folder.
If no destination folder is specified, the default one is used. """
If no destination folder is specified, the default one is used.
(The default downloads folder = "./downloaded_files") """
if not destination_folder:
destination_folder = constants.Files.DOWNLOADS_FOLDER
page_utils._download_file_to(file_url, destination_folder)
Expand All @@ -1627,6 +1629,14 @@ def save_file_as(self, file_url, new_file_name, destination_folder=None):
page_utils._download_file_to(
file_url, destination_folder, new_file_name)

def save_data_as(self, data, file_name, destination_folder=None):
""" Saves the data specified to a file of the name specified.
If no destination folder is specified, the default one is used.
(The default downloads folder = "./downloaded_files") """
if not destination_folder:
destination_folder = constants.Files.DOWNLOADS_FOLDER
page_utils._save_data_as(data, destination_folder, file_name)

def get_downloads_folder(self):
""" Returns the OS path of the Downloads Folder.
(Works with Chrome and Firefox only, for now.) """
Expand Down
7 changes: 7 additions & 0 deletions seleniumbase/fixtures/page_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
This module contains useful utility methods.
"""
import codecs
import re
import requests

Expand Down Expand Up @@ -76,6 +77,12 @@ def _download_file_to(file_url, destination_folder, new_file_name=None):
code.write(r.content)


def _save_data_as(data, destination_folder, file_name):
out_file = codecs.open(destination_folder + '/' + file_name, "w+")
out_file.writelines(data)
out_file.close()


def _jq_format(code):
"""
DEPRECATED - Use re.escape() instead, which performs the intended action.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='seleniumbase',
version='1.14.4',
version='1.14.5',
description='Web Automation & Testing Framework - http://seleniumbase.com',
long_description='Web Automation and Testing Framework - seleniumbase.com',
platforms='Mac * Windows * Linux * Docker',
Expand Down