Cannot send characters directly to the browser
The documentation implies that you can send keys directly to the browser, but the code expects an element name to be provided.
The result is an error like the following:
TypeError: BaseWebDriver.type() missing 1 required positional argument: 'value'
Is this something that's still supported?
From what I understand, the way to do this is as below.
from selenium.webdriver.common.keys import Keys
from splinter import Browser
from splinter.driver import webdriver
browser = Browser("firefox")
browser.visit("https://github.com")
driver = browser.driver
actions = webdriver.ActionChains(driver)
# Queue for effect only. The first / brings up the search bar,
# the others type the search query in the search bar, followed by
# Enter to submit the form.
send_keys = ["/", "cobrateam", "/", "splinter", Keys.ENTER]
for send in send_keys:
actions.send_keys(send)
actions.perform()
The function (implementation for web drivers) could be edited to run this code if no name argument is provided. But the function signature would not allow a default to just be set for name without value also having a default. Changing this would be a breaking change and affect some implementations.
More info from Stack Overflow.
Thus I agree, the documentation is misleading re this.
Awesome, thanks for clarifying.