|
@@ -71,20 +71,24 @@ class Ssgdfs(object):
|
|
|
return True
|
|
|
|
|
|
def open(self):
|
|
|
- self.display = Display(visible=0, size=(800, 600))
|
|
|
- self.display.start()
|
|
|
-
|
|
|
- self.driver = webdriver.Firefox()
|
|
|
+
|
|
|
+
|
|
|
+ self.driver = webdriver.Remote(command_executor=Demeter.config['setting']['phantomjs'], desired_capabilities=DesiredCapabilities.PHANTOMJS)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
def login(self):
|
|
|
- self.driver.get(self.config['login_link'])
|
|
|
+ self.get(self.config['login_link'])
|
|
|
+
|
|
|
self.driver.find_element_by_id('login-id').send_keys(self.config['username'])
|
|
|
self.driver.find_element_by_id('login-password').send_keys(self.config['password'])
|
|
|
self.driver.find_element_by_xpath('//input[@alt="login"]').click()
|
|
|
self.driver.implicitly_wait(5)
|
|
|
|
|
|
def order(self, product):
|
|
|
- self.driver.get(product)
|
|
|
+
|
|
|
+ self.get(product)
|
|
|
|
|
|
self.driver.execute_script('directOrderProduct()')
|
|
|
|
|
@@ -138,8 +142,8 @@ class Ssgdfs(object):
|
|
|
self.driver.find_element_by_id('agree').click()
|
|
|
|
|
|
self.driver.find_element_by_id('agree01').click()
|
|
|
-
|
|
|
- self.driver.find_element_by_xpath('//input[@id="pymntMeansCode" and @value="00"]').click()
|
|
|
+
|
|
|
+ self.driver.find_element_by_xpath('//input[@id="pymntMeansCode" and @value="16"]').click()
|
|
|
|
|
|
def crop(self, order, id):
|
|
|
path = Demeter.path + 'runtime/upload/'
|
|
@@ -155,7 +159,11 @@ class Ssgdfs(object):
|
|
|
def wait(self, name):
|
|
|
WebDriverWait(self.driver, 100).until(lambda x: x.find_element_by_class_name(name).is_displayed())
|
|
|
|
|
|
+ def get(self, link):
|
|
|
+ self.driver.get(product)
|
|
|
+ self.driver.implicitly_wait(20)
|
|
|
+
|
|
|
def close(self):
|
|
|
self.driver.quit()
|
|
|
|
|
|
- self.display.stop()
|
|
|
+
|