Last active
December 31, 2020 02:55
-
-
Save korakot/6feb109165b802e29c976384461c087f to your computer and use it in GitHub Desktop.
Using selenium in Colab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start | |
!pip install kora | |
from kora.selenium import wd | |
# go to | |
wd.get(url) | |
wd.current_url # now here | |
# show screen | |
display(wd) # or just wd | |
# run javascript | |
wd.execute_script(js_code) | |
# scroll to | |
wd.execute_script(f"document.querySelector('#mydiv').scrollIntoView()") | |
# fill form | |
email = wd.select1('input[type=email]') | |
email.send_keys("korakot@gmail.com") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Mr. Kora... I've been programming some python Selenium post-injection algorithms as of late, and I've stumbled across your algorithm within the last week or so... (w/in the last mo. or so for the three algorithms; design, learning, and scripting / debugging...)
I have a few questions if you'll be so kind as to allow me to ask them...
(a) Does the wd.select1('element[specifierRelativePathEl=property]') function like driver.find_element_by_xpath("//element[@specifierRelativePathEl='property']") ? ... (b.) If so, can one use multiple descriptors/selectors for a particular web element in conjunction ( ex: inputFieldNameVar = wd.select1('input[aria-disabled=false and aria-label=minutes]') )?
(a) If the latter case is true, what is the correct syntax to use the particular selenium elements in conjunction with your headless browser extension for Google Colab...? (b) Can you select a web element with a particular property selectors with multiple descriptors in the particular field in its xpath; i.e. in the same string, for say,
a class (ex: wd.select1('input[class = mr4k7n6j b11tv86q n1muyh1j kh2nmh7l [...] and autocomplete=off ]')) ?
Thank you so much for your time. Merry Christmas, and Happy New Year!