from selenium.webdriver import Remote
import time
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
driver = Remote(command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities={'platform': 'ANY',
'browserName':'firefox',
'version': '',
'javascriptEnabled': True})
driver.get('http://www.baidu.com')
title=driver.title
print (title)
time.sleep(3)
driver.quit()
上面是我写的
下面是用selenium ide录的
from selenium import selenium
import unittest, time, re
class rc(unittest.TestCase):
def setUp(self):
self.verificationErrors = []
self.selenium = selenium("localhost", 4444, "*chrome", "https://www.baidu.com/")
self.selenium.start()
def test_rc(self):
sel = self.selenium
sel.open("/")
sel.type("id=kw", "selenium")
sel.click("id=container")
sel.click("id=su")
def tearDown(self):
self.selenium.stop()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()
都是用selenium server
这两段代码有什么区别?
指的是,它们都可以用selenium server吧?
呃。。。好像没说明白,能理解吗!
业精于勤,荒于嬉;行成于思,毁于随。