Zdek Util libraries for Pythom coding
Project description
SeleniumUts
Uma biblioteca Python que encapsula algumas funcionalidades do Selenium WebDriver, facilitando a automação de navegadores para testes e raspagem de dados. A biblioteca suporta o uso do undetected_chromedriver e integra-se facilmente com o Selenoid para execução de testes em ambientes distribuídos.
Uso
Importando a Biblioteca
from seleniumUts import SeleniumUts
Criando uma Instância de SeleniumUts
selenium_lib = SeleniumUts()
Exemplos de Uso
Configurando o Selenium com ChromeDriver
# Configure o Selenium sem usar o Selenoid
selenium_lib.setupSelenium(host=None, use_selenoid=False)
# Abrir uma página web
driver = selenium_lib.open_page('https://www.example.com')
# Fechar o navegador
selenium_lib.close()
Configurando o Selenium com Selenoid
# Configure o Selenium usando o Selenoid
selenoid_host = 'http://your-selenoid-server.com/wd/hub'
selenium_lib.setupSelenium(host=selenoid_host, use_selenoid=True)
# Abrir uma página web
driver = selenium_lib.open_page('https://www.example.com')
# Fechar o navegador
selenium_lib.close()
Aguardando a Visibilidade de um Elemento
# Configure o Selenium
selenium_lib.setupSelenium(host=None, use_selenoid=False)
# Abrir uma página web
selenium_lib.open_page('https://www.example.com')
# Esperar até que o elemento esteja visível
element = selenium_lib.wait_xpath('//button[@id="submit"]', time=10)
element.click()
# Fechar o navegador
selenium_lib.close()
Envio de Texto com Atraso entre Caracteres
# Configure o Selenium
selenium_lib.setupSelenium(host=None, use_selenoid=False)
# Abrir uma página web
selenium_lib.open_page('https://www.example.com')
# Encontrar o campo de texto e enviar texto com atraso
element = selenium_lib.wait_xpath('//input[@id="search-box"]')
element.delayed_send('Python Selenium', delay=0.2)
# Fechar o navegador
selenium_lib.close()
Rolagem até o Fim da Página
# Configure o Selenium
selenium_lib.setupSelenium(host=None, use_selenoid=False)
# Abrir uma página web
selenium_lib.open_page('https://www.example.com')
# Rolagem até o fim da página
selenium_lib.scroll_end()
# Fechar o navegador
selenium_lib.close()
Métodos Disponíveis
setupSelenium(host, name="default", use_selenoid=False, cust_opt=[], remove_default_options=False, download_path=None, selenoid_browser=("chrome","110.0")): Configura o WebDriver do Selenium com opções personalizadas e preferências para o ChromeDriver. Suporta configuração para Selenoid.open_page(page): Abre uma página web e espera até que ela seja totalmente carregada.wait_xpath(path, time=20, throw=True): Aguarda até que um elemento, identificado por um caminho XPath, esteja visível no DOM.<el>.delayed_send(word, delay): Envia texto para um elemento, inserindo um atraso especificado entre cada caractere.scroll_end(): Rola até o final da página atual.close(): Fecha o navegador e encerra a sessão do WebDriver.
Contribuição
Contribuições são bem-vindas! Por favor, envie um pull request ou abra uma issue para quaisquer problemas ou melhorias.
Licença
Este projeto está licenciado sob a licença MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file seleniumuts-1.2.3.tar.gz.
File metadata
- Download URL: seleniumuts-1.2.3.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7400185f07fb2c2dd46b7d29cf797bd94c1c17fc4bacf10c1fc14871c3e1c065
|
|
| MD5 |
491af428dc8a7d29d17c693502cf710e
|
|
| BLAKE2b-256 |
67df0e1dc20a2b8100aea3b7b607909ac9e9b9a63d334586c24752d09d601a47
|
Provenance
The following attestation bundles were made for seleniumuts-1.2.3.tar.gz:
Publisher:
deploy.yml on ZdekPyPi/SeleniumUts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
seleniumuts-1.2.3.tar.gz -
Subject digest:
7400185f07fb2c2dd46b7d29cf797bd94c1c17fc4bacf10c1fc14871c3e1c065 - Sigstore transparency entry: 1082243862
- Sigstore integration time:
-
Permalink:
ZdekPyPi/SeleniumUts@10409fca909f9b68a962268afc8c2194bbc44c53 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ZdekPyPi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@10409fca909f9b68a962268afc8c2194bbc44c53 -
Trigger Event:
push
-
Statement type:
File details
Details for the file seleniumuts-1.2.3-py3-none-any.whl.
File metadata
- Download URL: seleniumuts-1.2.3-py3-none-any.whl
- Upload date:
- Size: 14.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24832e5a5275c5d87b8d5a76c8ce67cf09345a73aaa44019086e3400954a380f
|
|
| MD5 |
060d0fe80fcb9841c4c3ecfa644512be
|
|
| BLAKE2b-256 |
77d075b4eb9be09b50295a845291745034ffc49211a71ef53e931766ddeab1fe
|
Provenance
The following attestation bundles were made for seleniumuts-1.2.3-py3-none-any.whl:
Publisher:
deploy.yml on ZdekPyPi/SeleniumUts
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
seleniumuts-1.2.3-py3-none-any.whl -
Subject digest:
24832e5a5275c5d87b8d5a76c8ce67cf09345a73aaa44019086e3400954a380f - Sigstore transparency entry: 1082243907
- Sigstore integration time:
-
Permalink:
ZdekPyPi/SeleniumUts@10409fca909f9b68a962268afc8c2194bbc44c53 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ZdekPyPi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@10409fca909f9b68a962268afc8c2194bbc44c53 -
Trigger Event:
push
-
Statement type: