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
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[<img src="https://img.shields.io/github/release/seleniumbase/SeleniumBase.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/releases) [<img src="https://dev.azure.com/seleniumbase/seleniumbase/_apis/build/status/seleniumbase.SeleniumBase?branchName=master" alt=" " />](https://dev.azure.com/seleniumbase/seleniumbase/_build/latest?definitionId=1&branchName=master) [<img src="https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master" alt=" " />](https://travis-ci.org/seleniumbase/SeleniumBase) [<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt=" " />](https://gitter.im/seleniumbase/SeleniumBase) [<img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE) [<img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/stargazers)<br />

All-in-one testing framework for automated E2E tests, [assisted-QA](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md), and [website tours](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md).
All-in-one framework for automated E2E testing, [assisted-QA](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md), and [website tours](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md).

<img src="https://cdn2.hubspot.net/hubfs/100006/images/new_demo_gif.gif" title="SeleniumBase" height="225"><br />
(<i>Above: [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) from [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) running in demo mode, which adds JavaScript for highlighting page actions.</i>)<br />
Expand All @@ -12,23 +12,21 @@ pytest my_first_test.py --demo_mode

SeleniumBase uses [pytest](https://github.com/pytest-dev/pytest) for running Python scripts, while using [Selenium WebDriver](https://www.seleniumhq.org/) for controlling web browsers.

## <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Get Started:
## Get Started:

### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Install Python:
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Install ``Python``: [<img src="https://img.shields.io/badge/python-2.7,_3.5,_3.6,_3.7+-22AADD.svg" alt=" " />](https://www.python.org/downloads/)

**[python.org/downloads/](https://www.python.org/downloads/)**
[<img src="https://img.shields.io/badge/python-2.7,_3.5,_3.6,_3.7,_3.8+-22AADD.svg" alt=" " />](https://www.python.org/downloads/)
Get it from **[python.org/downloads](https://www.python.org/downloads/)** and add Python to your System PATH.

### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Install/upgrade ``pip``:
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Upgrade ``pip``:

With Python installed and on your System PATH, you can get the latest ``pip`` with:
```bash
python -m easy_install -U pip
```

### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Setup a Python Virtual Env:
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Create a Python Virtual Env:

It is **recommended** to use a **Python Virtual Environment** to isolate Python dependencies between projects. Instructions on creating one can be found **[here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md)**. (<i>Learn more about virtual environments on the **[official site](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)**.</i>)
It is **recommended** to use a **Python Virtual Environment** to isolate Python dependencies between projects. Instructions on creating one can be found **[HERE](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md)**. (<i>Learn more about virtual environments on the **[official site](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)**.</i>)

### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Install ``seleniumbase``: [<img src="https://img.shields.io/badge/pypi-seleniumbase-22AAEE.svg" alt=" " />](https://pypi.python.org/pypi/seleniumbase)
```bash
Expand Down Expand Up @@ -599,7 +597,7 @@ If the web page you're on already has jQuery loaded, you can start executing jQu
You'd know this because the web page would contain something like the following in the HTML:

```html
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
```

It's OK if you want to use jQuery on a page that doesn't have it loaded yet. To do so, run the following command first:
Expand Down Expand Up @@ -714,4 +712,4 @@ If you see something, say something! We are very active in resolving issues. [<i

[https://github.com/mdmintz](https://github.com/mdmintz)<br />

[<img src="https://cdn2.hubspot.net/hubfs/100006/images/sb_media_logo_2.png" title="SeleniumBase" height="120">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md) <br /> [<img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE)
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/sb_media_logo.png" title="SeleniumBase" height="120">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md) <br /> [<img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE)
10 changes: 0 additions & 10 deletions examples/boilerplates/samples/bing_objects.py

This file was deleted.

19 changes: 0 additions & 19 deletions examples/boilerplates/samples/bing_test.py

This file was deleted.

1 change: 1 addition & 0 deletions examples/boilerplates/samples/google_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ class HomePage(object):

class ResultsPage(object):
google_logo = 'img[alt="Google"]'
images_link = 'link=Images'
search_results = 'div#center_col'
4 changes: 1 addition & 3 deletions examples/boilerplates/samples/google_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@ def test_google_dot_com(self):
self.assert_element(HomePage.feeling_lucky_button)
self.click(HomePage.search_button)
self.assert_text('github.com', ResultsPage.search_results)
self.click_link_text('Images')
source = self.get_page_source()
self.assert_true("Image result for github" in source)
self.assert_element(ResultsPage.images_link)
2 changes: 1 addition & 1 deletion integrations/google_cloud/ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Building a browser-based test automation server on the [Google Cloud Platform](https://cloud.google.com/) by using [SeleniumBase](https://github.com/seleniumbase/SeleniumBase)

(This tutorial, [from a previous GCP Meetup live demo](http://www.meetup.com/Boston-Google-Cloud-Meetup/events/230839686/?showDescription=true), will teach you how to setup a Linux server for running automated browser tests. The cost of running this server is [$14.20/month on Google Cloud](https://console.cloud.google.com/launcher/details/bitnami-launchpad/jenkins) (enough to handle **6 parallel tests**). This is amazingly **20 times LESS expensive** than using competitors such as [BrowserStack](https://www.browserstack.com/pricing) or [Sauce Labs](https://saucelabs.com/pricing) **for the SAME number of parallel tests**.)
(This tutorial, [from a previous Google Cloud Meetup](http://www.meetup.com/Boston-Google-Cloud-Meetup/events/230839686/?showDescription=true), will teach you how to setup a Linux server for running automated browser tests. The cost of running this server is about [$13.61/month on Google Cloud](https://console.cloud.google.com/launcher/details/bitnami-launchpad/jenkins) (enough to handle **6 parallel tests**). This is much less expensive than using competitors such as [BrowserStack](https://www.browserstack.com/pricing) or [Sauce Labs](https://saucelabs.com/pricing) **for the SAME number of parallel tests**.)

#### Step 1. Open the Google Cloud Platform Cloud Launcher

Expand Down
41 changes: 2 additions & 39 deletions seleniumbase/console_scripts/sb_mkdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,41 +196,6 @@ def main():
file.writelines("\r\n".join(data))
file.close()

data = []
data.append("from seleniumbase import BaseCase")
data.append("from .bing_objects import Page")
data.append("")
data.append("")
data.append("class BingTests(BaseCase):")
data.append("")
data.append(" def test_bing(self):")
data.append(" self.open('https://bing.com')")
data.append(" self.assert_text('Bing', Page.logo_box)")
data.append(" self.update_text(Page.search_box, 'github')")
data.append(" self.assert_element('li[query=\"github\"]')")
data.append(" self.click(Page.search_button)")
data.append(
" self.assert_text('github.com', Page.search_results)")
data.append(" self.click_link_text('Images')")
data.append(" self.assert_element('img[alt*=\"github\"]')")
data.append("")
file_path = "%s/%s" % (dir_name_3, "bing_test.py")
file = codecs.open(file_path, "w+", "utf-8")
file.writelines("\r\n".join(data))
file.close()

data = []
data.append("class Page(object):")
data.append(" logo_box = '#sbox div[class*=logo]'")
data.append(" search_box = 'input.b_searchbox'")
data.append(" search_button = 'input[name=\"go\"]'")
data.append(" search_results = '#b_results'")
data.append("")
file_path = "%s/%s" % (dir_name_3, "bing_objects.py")
file = codecs.open(file_path, "w+", "utf-8")
file.writelines("\r\n".join(data))
file.close()

data = []
data.append("from seleniumbase import BaseCase")
data.append("from .google_objects import HomePage, ResultsPage")
Expand All @@ -250,10 +215,7 @@ def main():
data.append(
" self.assert_text('github.com', "
"ResultsPage.search_results)")
data.append(" self.click_link_text('Images')")
data.append(" source = self.get_page_source()")
data.append(
" self.assert_true('Image result for github' in source)")
data.append(" self.assert_element(ResultsPage.images_link)")
data.append("")
file_path = "%s/%s" % (dir_name_3, "google_test.py")
file = codecs.open(file_path, "w+", "utf-8")
Expand All @@ -273,6 +235,7 @@ def main():
data.append("")
data.append("class ResultsPage(object):")
data.append(" google_logo = 'img[alt=\"Google\"]'")
data.append(" images_link = 'link=Images'")
data.append(" search_results = 'div#center_col'")
data.append("")
file_path = "%s/%s" % (dir_name_3, "google_objects.py")
Expand Down
8 changes: 7 additions & 1 deletion seleniumbase/utilities/selenium_ide/objectify.py
Original file line number Diff line number Diff line change
Expand Up @@ -1314,9 +1314,15 @@ def main(shell_command):
object_name = "%s.%s" % (str(key), str(pair[0]))
object_dict[object_name] = pair[1]

good_sel_dict = {}
aa, bb, cc = scan_objects_file()
for s_key in selector_dict.keys():
if s_key in bb:
good_sel_dict[s_key] = selector_dict[s_key]

if shell_command == "inject-objects" or shell_command == "objectify":
seleniumbase_lines, page_selectors, changed = process_test_file(
code_lines, selector_dict=selector_dict, add_comments=add_comments)
code_lines, selector_dict=good_sel_dict, add_comments=add_comments)
added_classes = []
for item in changed:
if item not in added_classes:
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
os.system('rm -f dist/*.egg; rm -f dist/*.tar.gz; rm -f dist/*.whl')
os.system('python setup.py sdist bdist_wheel') # Create new tar/wheel
print("\n*** Installing twine: *** (Required for PyPI uploads)\n")
os.system("python -m pip install 'twine>=1.14.0'")
os.system("python -m pip install 'twine>=1.15.0'")
print("\n*** Publishing The Release to PyPI: ***\n")
os.system('python -m twine upload dist/*') # Requires ~/.pypirc Keys
print("\n*** The Release was PUBLISHED SUCCESSFULLY to PyPI! :) ***\n")
Expand All @@ -45,7 +45,7 @@

setup(
name='seleniumbase',
version='1.32.1',
version='1.32.2',
description='Fast, Easy, and Reliable Browser Automation & Testing.',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down