Skip to content

2.0.0rc2

Compare
Choose a tag to compare
@yashaka yashaka released this 13 Apr 16:52
· 188 commits to master since this release

Smarter guessing of which driver to build

Driver is guessed by config.driver_options too

Before:

  • config.driver_name was 'chrome' by default

Now:

  • config.driver_name is None by default
    • and means "desired requested driver name"
  • setting config.driver_options usually is enough to guess the driver name,
    e.g., just by setting config.driver_options = FirefoxOptions()
    you already tell Selene to build Firefox driver.

config.driver_service

Just in case you want, e.g. to use own driver executable like:

from selene import browser
from selenium.webdriver.chrome.service import Service
from selenium import webdriver

browser.config.driver_service = Service('/path/to/my/chromedriver')
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
browser.config.driver_options = chrome_options

command.select_all to simulate ctrl+a or cmd+a on mac

from selene import browser, by, have, command

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

browser.element(by.name('q')).type('selene').should(have.value('selene'))

browser.element(by.name('q')).perform(command.select_all).type('github yashaka selene')
browser.element(by.name('q')).should(have.value('github yashaka selene'))

Probably might be useful for cases where normal element.set_value(text), while based on webelement.clear(); webelement.send_keys(text), - does not work, in most cases because of some events handled on clear().

command._long_press

More relevant to the mobile case. Might work for web too, but not tested fully for web, not covered with tests. That's why is still marked with _ as experimental.