Jump to content

Selenium: Difference between revisions

 
Line 18:
export GECKO_DRIVER_VERSION='v0.29.0'
 
= Using Self Signed Certificates =
= Sample Code =
<syntaxhighlight lang="python">
from selenium import webdriver
Line 35:
 
browser.close()
</syntaxhighlight>
 
= Testing reachability =
 
<syntaxhighlight lang="python">
#!/usr/bin/env python
 
import unittest
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
 
class TestUbuntuHomepage(unittest.TestCase):
 
def setUp(self):
options = Options()
options.add_argument("--headless")
self.browser = webdriver.Firefox(options=options)
 
def testTitle(self):
self.browser.get('http://www.ubuntu.com/')
self.assertIn('Ubuntu', self.browser.title)
 
def tearDown(self):
self.browser.quit()
 
 
if __name__ == '__main__':
unittest.main(verbosity=2)
</syntaxhighlight>
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.