def test_changes_window_size_on_open_according_to_config(chrome_driver): browser = Browser( Config( driver=chrome_driver, window_width=640, window_height=480, ) ) browser.open(givenpage.EMPTY_PAGE_URL) assert browser.driver.get_window_size()['width'] == 640 assert browser.driver.get_window_size()['height'] == 480
from selene import Browser, Config from selenium.webdriver import Firefox """ Element """ browser = Browser( Config(driver=Firefox(), base_url='https://selenium.dunossauro.live', timeout=30)) browser.open('/aula_07') elementos = browser.all('input') elementos[0].type('rafael') elementos[1].type('rafael@rafael') elementos[2].type('rafael') elementos[3].press_enter()
from selene import Browser, Config from selenium.webdriver import Firefox from selene.support import by from selene.support.conditions import not_, be, have """ Validação """ browser = Browser( Config( driver=Firefox(), base_url='https://google.com', ) ) browser.open('') browser.s(by.name('q')).should(be.blank).type('Live de python') browser.s(by.name('q')).should(not_.blank).type('teste em python') browser.s(by.name('q')).should(have.attribute('name').value('q'))
from selene import Browser, Config from selenium.webdriver import Remote base_url = 'http://selenium.dunossauro.live' browser = Browser( Config( driver=Remote(desired_capabilities={'browserName': 'firefox'}), base_url=base_url, )) browser.open('/caixinha')