SaossionPage


NameSaossionPage JSON
Version 1.0.6 PyPI version JSON
download
home_pageNone
SummaryA sao shen library
upload_time2024-10-22 03:50:10
maintainerNone
docs_urlNone
authorsao shen
requires_pythonNone
licenseNone
keywords python menu saoshen windows saossionpage linux
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# SaossionPage[骚神库]

![logo](https://wxhzhwxhzh.github.io/saossion_code_helper_online/img/saoshen2.png)



[![Downloads](https://static.pepy.tech/badge/SaossionPage)](https://pepy.tech/project/SaossionPage)



The brother version of the Drissionpage library, SaossionPage, is referred to as Sao Shen for short





## Installation



```

pip install SaossionPage

```







## Usage



 example 1:      Print the tree structure of the element tag





```python



from SaossionPage import Browser





if __name__ == '__main__':

    browser = Browser(config=" ")



    browser.open('https://www.doc88.com/')



    t=browser.page.latest_tab

    y=t.ele('t:body')

    t.wait(2)     

    # 打印元素标签的树结构

    browser.get_tree(y)  



    input(' press any key to exit')



```

example 2: Convert native HTML tag syntax to DP library element syntax





```python

#将原生html标签语法转换成DP库元素语法

from SaossionPage import Browser,Use





if __name__ == '__main__':

    #连接浏览器

    b=Browser()

    t=b.page.new_tab('https://www.baidu.com/')

    #获取元素



    search_botton=t.ele(Use.raw('<input type="submit" id="su" value="百度一下" class="bg s_btn">'))

    

    print(search_botton)



    input(' press any key to exit')



```



example 3: Foolish browser startup configuration





```python

# 傻瓜式浏览器启动配置

from SaossionPage import Browser





if __name__ == '__main__':



    #  连接浏览器  傻瓜式自动识别配置

    browser = Browser(  r"C:\Users\Application\chrome.exe",config=' 静音  无图 代理http://127.0.0.1:1080 ')



    # 打开网站 

    browser.open('https://www.bing.com/')    



    input(' press any key to exit')



```

example 4: High-definition element screenshots





```python

# 高清元素截图

from SaossionPage import Browser



if __name__ == '__main__':

    browser = Browser(config=" ")



    browser.open('https://www.python.org/')

    t=browser.page.latest_tab

    y=t.ele('t:body')

    t.wait(2)

     

    # 截图

    browser.get_shot_by_canvas(tab=t,ele=y,name='shot.png')     







    input(' press any key to exit')



```

example 5: # Extract JSON data returned by asynchronous function





```python

# 提取异步函数返回的json数据

from SaossionPage import Browser,Tool



if __name__ == '__main__':

    browser = Browser(config='  ')

    url='https://spa3.scrape.center/'

    tab=browser.page.new_tab(url) 

    js_code=r'''fetch("https://spa3.scrape.center/api/movie/?limit=10&offset=0", {

                "referrer": "https://spa3.scrape.center/",

                "referrerPolicy": "strict-origin-when-cross-origin",

                "body": null,

                "method": "GET",

                "mode": "cors",

                "credentials": "omit"

                });

                '''

    



    aa=Tool.get_json_by_js_fetch(tab=tab,fetch_code=js_code) 

    print(aa) 





    input(' press any key to exit')



```

example 6: #  支持上下文管理协议的 new_page







```python

#  支持上下文管理协议的 new_page

from SaossionPage import Browser



if __name__ == '__main__':

    browser=Browser()

    with  browser.new_page('https://tencent.com/')  as t:

        print(t.title)



    input('press any  to continue...')   



```







## Update log







- `1.0.6` fix bug

- `1.0.5` add  NewPage the context manager

- `1.0.4` add  fetch_code

- `1.0.3` add  logo

- `1.0.2` update  README.md

- `1.0.1` fix bug

- `1.0.0` first release




            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "SaossionPage",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python, menu, saoshen, windows, SaossionPage, linux",
    "author": "sao shen",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/a9/90/5fc311f0b355acdca2823258d63d190aaa88f3a32f74daf001f7348e2595/SaossionPage-1.0.6.tar.gz",
    "platform": null,
    "description": "\r\n# SaossionPage[\u9a9a\u795e\u5e93]\r\r\n![logo](https://wxhzhwxhzh.github.io/saossion_code_helper_online/img/saoshen2.png)\r\r\n\r\r\n[![Downloads](https://static.pepy.tech/badge/SaossionPage)](https://pepy.tech/project/SaossionPage)\r\r\n\r\r\nThe brother version of the Drissionpage library, SaossionPage, is referred to as Sao Shen for short\r\r\n\r\r\n\r\r\n## Installation\r\r\n\r\r\n```\r\r\npip install SaossionPage\r\r\n```\r\r\n\r\r\n\r\r\n\r\r\n## Usage\r\r\n\r\r\n example 1:      Print the tree structure of the element tag\r\r\n\r\r\n\r\r\n```python\r\r\n\r\r\nfrom SaossionPage import Browser\r\r\n\r\r\n\r\r\nif __name__ == '__main__':\r\r\n    browser = Browser(config=\" \")\r\r\n\r\r\n    browser.open('https://www.doc88.com/')\r\r\n\r\r\n    t=browser.page.latest_tab\r\r\n    y=t.ele('t:body')\r\r\n    t.wait(2)     \r\r\n    # \u6253\u5370\u5143\u7d20\u6807\u7b7e\u7684\u6811\u7ed3\u6784\r\r\n    browser.get_tree(y)  \r\r\n\r\r\n    input(' press any key to exit')\r\r\n\r\r\n```\r\r\nexample 2: Convert native HTML tag syntax to DP library element syntax\r\r\n\r\r\n\r\r\n```python\r\r\n#\u5c06\u539f\u751fhtml\u6807\u7b7e\u8bed\u6cd5\u8f6c\u6362\u6210DP\u5e93\u5143\u7d20\u8bed\u6cd5\r\r\nfrom SaossionPage import Browser,Use\r\r\n\r\r\n\r\r\nif __name__ == '__main__':\r\r\n    #\u8fde\u63a5\u6d4f\u89c8\u5668\r\r\n    b=Browser()\r\r\n    t=b.page.new_tab('https://www.baidu.com/')\r\r\n    #\u83b7\u53d6\u5143\u7d20\r\r\n\r\r\n    search_botton=t.ele(Use.raw('<input type=\"submit\" id=\"su\" value=\"\u767e\u5ea6\u4e00\u4e0b\" class=\"bg s_btn\">'))\r\r\n    \r\r\n    print(search_botton)\r\r\n\r\r\n    input(' press any key to exit')\r\r\n\r\r\n```\r\r\n\r\r\nexample 3: Foolish browser startup configuration\r\r\n\r\r\n\r\r\n```python\r\r\n# \u50bb\u74dc\u5f0f\u6d4f\u89c8\u5668\u542f\u52a8\u914d\u7f6e\r\r\nfrom SaossionPage import Browser\r\r\n\r\r\n\r\r\nif __name__ == '__main__':\r\r\n\r\r\n    #  \u8fde\u63a5\u6d4f\u89c8\u5668  \u50bb\u74dc\u5f0f\u81ea\u52a8\u8bc6\u522b\u914d\u7f6e\r\r\n    browser = Browser(  r\"C:\\Users\\Application\\chrome.exe\",config=' \u9759\u97f3  \u65e0\u56fe \u4ee3\u7406http://127.0.0.1:1080 ')\r\r\n\r\r\n    # \u6253\u5f00\u7f51\u7ad9 \r\r\n    browser.open('https://www.bing.com/')    \r\r\n\r\r\n    input(' press any key to exit')\r\r\n\r\r\n```\r\r\nexample 4: High-definition element screenshots\r\r\n\r\r\n\r\r\n```python\r\r\n# \u9ad8\u6e05\u5143\u7d20\u622a\u56fe\r\r\nfrom SaossionPage import Browser\r\r\n\r\r\nif __name__ == '__main__':\r\r\n    browser = Browser(config=\" \")\r\r\n\r\r\n    browser.open('https://www.python.org/')\r\r\n    t=browser.page.latest_tab\r\r\n    y=t.ele('t:body')\r\r\n    t.wait(2)\r\r\n     \r\r\n    # \u622a\u56fe\r\r\n    browser.get_shot_by_canvas(tab=t,ele=y,name='shot.png')     \r\r\n\r\r\n\r\r\n\r\r\n    input(' press any key to exit')\r\r\n\r\r\n```\r\r\nexample 5: # Extract JSON data returned by asynchronous function\r\r\n\r\r\n\r\r\n```python\r\r\n# \u63d0\u53d6\u5f02\u6b65\u51fd\u6570\u8fd4\u56de\u7684json\u6570\u636e\r\r\nfrom SaossionPage import Browser,Tool\r\r\n\r\r\nif __name__ == '__main__':\r\r\n    browser = Browser(config='  ')\r\r\n    url='https://spa3.scrape.center/'\r\r\n    tab=browser.page.new_tab(url) \r\r\n    js_code=r'''fetch(\"https://spa3.scrape.center/api/movie/?limit=10&offset=0\", {\r\r\n                \"referrer\": \"https://spa3.scrape.center/\",\r\r\n                \"referrerPolicy\": \"strict-origin-when-cross-origin\",\r\r\n                \"body\": null,\r\r\n                \"method\": \"GET\",\r\r\n                \"mode\": \"cors\",\r\r\n                \"credentials\": \"omit\"\r\r\n                });\r\r\n                '''\r\r\n    \r\r\n\r\r\n    aa=Tool.get_json_by_js_fetch(tab=tab,fetch_code=js_code) \r\r\n    print(aa) \r\r\n\r\r\n\r\r\n    input(' press any key to exit')\r\r\n\r\r\n```\r\r\nexample 6: #  \u652f\u6301\u4e0a\u4e0b\u6587\u7ba1\u7406\u534f\u8bae\u7684 new_page\r\r\n\r\r\n\r\r\n\r\r\n```python\r\r\n#  \u652f\u6301\u4e0a\u4e0b\u6587\u7ba1\u7406\u534f\u8bae\u7684 new_page\r\r\nfrom SaossionPage import Browser\r\r\n\r\r\nif __name__ == '__main__':\r\r\n    browser=Browser()\r\r\n    with  browser.new_page('https://tencent.com/')  as t:\r\r\n        print(t.title)\r\r\n\r\r\n    input('press any  to continue...')   \r\r\n\r\r\n```\r\r\n\r\r\n\r\r\n\r\r\n## Update log\r\r\n\r\r\n\r\r\n\r\r\n- `1.0.6` fix bug\r\r\n- `1.0.5` add  NewPage the context manager\r\r\n- `1.0.4` add  fetch_code\r\r\n- `1.0.3` add  logo\r\r\n- `1.0.2` update  README.md\r\r\n- `1.0.1` fix bug\r\r\n- `1.0.0` first release\r\r\n\r\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A sao shen library",
    "version": "1.0.6",
    "project_urls": null,
    "split_keywords": [
        "python",
        " menu",
        " saoshen",
        " windows",
        " saossionpage",
        " linux"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a9905fc311f0b355acdca2823258d63d190aaa88f3a32f74daf001f7348e2595",
                "md5": "e7d6efe333ba5cf73f1e74cfa420c763",
                "sha256": "cbd4f8b0bb280800dbae4334cd7c2dd0149530129516b2e573b09b7cd9f41aba"
            },
            "downloads": -1,
            "filename": "SaossionPage-1.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "e7d6efe333ba5cf73f1e74cfa420c763",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 96606,
            "upload_time": "2024-10-22T03:50:10",
            "upload_time_iso_8601": "2024-10-22T03:50:10.141117Z",
            "url": "https://files.pythonhosted.org/packages/a9/90/5fc311f0b355acdca2823258d63d190aaa88f3a32f74daf001f7348e2595/SaossionPage-1.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-22 03:50:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "saossionpage"
}
        
Elapsed time: 0.46089s