Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.7%) to scientific vocabulary
Keywords
Repository
not only page object. A package for Page Object Model (POM)
Basic Info
Statistics
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 0
- Releases: 12
Topics
Metadata Files
README.md
nopo

nopo (not only page object) is a package for Page Object Model (POM), a tool based on Selenium that helps you build POM in web test.
View the development of it (in Chinese)
Features
- Define and operate an element or elements like using Selenium (but with advanced features)
- Auto wait and find the element(s)
- Cascading selectors support in an element
Install
bash
pip install nopo
Usage
Example
Here shows a simple usage example:
```python from selenium import webdriver from selenium.webdriver.common.keys import Keys
from nopo import El, Els, By, Pg
class GitHubPage(Pg):
# Define like Selenium
textbox = El(By.XPATH, '//input[@aria-label="Search GitHub"]')
main_page = El(By.TAG_NAME, 'main')
user_a = El(By.CLASS_NAME, 'mr-1')
name = El(By.XPATH, '//span[@itemprop="name"]')
def search_user(self, name):
# Operate like Selenium, but with advanced features.
self.textbox.send_keys(name, clear=True)
self.textbox.send_keys(Keys.ENTER)
# Elements define
# Use El_1 / El_2 to define cascading element(s)
# Use El(el=El_old) or Els(el=El_old) to turn type
lis = Els(el=(self.main_page / El(By.XPATH, './/nav[1]') / El(By.TAG_NAME, 'a')))
lis[-1].click()
self.user_a.click()
assert self.name.value == 'Ding Junyao'
if name == 'main': driver = webdriver.Chrome() driver.maximizewindow() driver.get('https://github.com/') ghpage = GitHubPage(driver) ghpage.searchuser('DingJunyao') driver.quit() ```
Defining
In class which has driver attribute to selenium webdriver (e.g., nopo.Pg class), you can define it as a class attribute:
python
example_el = El(by, selector_str)
example_els = Els(by, selector_str)
You can also use attribute driver to specify a webdriver or use in other occasions:
python
example_el = El(by, selector_str, driver=driver)
example_els = Els(by, selector_str, driver=driver)
Operating
```python el.text # Text of the element. el.value # Returns text. If text is None or '', return value property (mostly for input element). el.exist # To show if the element exists. el.existwait # To show if the element exists (with wait). el.isselected # Returns if the element is selected. el.selectorsxpath # Returns selector to xpath. el.elem # Returns the WebElement instance of the element (with wait). el.elemclickable # Returns the WebElement instance of the element (wait for clickable). el.elemnowait # Returns the WebElement instance of the element (without wait).
el.options # Returns a list of all options belonging to this select tag el.allselectedoptions # Returns a list of all selected options belonging to this select tag el.firstselectedoption # Returns the first selected option in this select tag.
el.click() # Click the element. el.clear(force=False) # Clear the element. Use force=True to ensure the element can be cleared to deal with some situation. el.sendkeys(keys, clear=False, forceclear=False) # Send keys to element. If clear is True, clear the element before sending. If clear and force are True, clear will be in force mode. el.csk(keys, forceclear=False) # Clear and send keys to element. If forceclear is True, clear will be in force mode. el.nncsk(keys, forceclear=False) # Clear and send keys if keys is not None. If forceclear is True, clear will be in force mode. el.getattribute(attr) # Get attribute of the element. el.getproperty(propertytext) # Get property of the element. el.waitforclick() # Wait until the element is clickable. el.waitforpresent() # Wait until the element is present.
el.selectbyvalue(value) # Select options by given value argument. el.selectbyindex(index) # Select the option at the given index. el.selectbyvisibletext(text) # Select options by visible text. el.deselectall() # Clear all selected entries. el.deselectbyvalue(value) # Deselect options by given value argument. el.deselectbyindex(index) # Deselect the option at the given index. el.deselectbyvisible_text(text) # Deselect options by visible text.
el.switch_in() # Switch in the frame.
El.singleselectorto_xpath(by, selector) # Return single selector to xpath. ```
Cascading
You can use / to cascading selectors:
python
el1 = El(by1, selector_str1)
el2 = El(by2, selector_str2)
example_el = el1 / el2
The type of example_el above is same as el1, and find element using selector of el1 and el2, like the following code in selenium:
python
el1 = driver.find_element.by(by1, selector_str1)
example_el = el1.find_element.by(by2, selector_str2)
Extending
el attribute helps you transfer class type, which makes it easy to customize element(s):
```python class MyEl(El): pass
example_el = MyEl(el=el1 / el2) ```
Build
```bash pip install -r requirements.txt
python -m build
or
python3 -m build ```
Further plan
- More operating functions
- Ready-to-use Element classes for frontend frameworks (like Ant Design and Element)
License
Apache License Version 2.0
Owner
- Name: Ding Junyao
- Login: DingJunyao
- Kind: user
- Location: Nanjing
- Company: Foxconn (Nanjing) Software Company
- Website: https://4ading.com/
- Repositories: 3
- Profile: https://github.com/DingJunyao
这句话一共有五十四笔 These words have thirty-nine strokes. These words have 26 strokes.
GitHub Events
Total
Last Year
Committers
Last synced: over 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| DingJunyao | d****3@1****m | 17 |
| Ding Junyao | 1****o | 11 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: over 1 year ago
All Time
- Total issues: 0
- Total pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 10 minutes
- Total issue authors: 0
- Total pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- DingJunyao (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 72 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 12
- Total maintainers: 1
pypi.org: nopo
not only page object: A package for Page Object Model (POM), a tool based on Selenium that helps you build POM in web test.
- Homepage: https://github.com/DingJunyao/nopo
- Documentation: https://nopo.readthedocs.io/
- License: Apache Software License
-
Latest release: 1.3.1
published almost 3 years ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v2 composite
- actions/setup-python v2 composite
- nanasess/setup-chromedriver master composite
- actions/checkout v2 composite
- actions/setup-python v2 composite
- pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
- build *
- cssselect *
- pytest *
- pytest-selenium *
- selenium *
- twine *