Beispiel #1
0
def check_copy_content(driver, content):
    input_id = COMMENT_INPUT
    if element_exsist(driver, 'id', COMMENT_INPUT_VIDEO):
        input_id = COMMENT_INPUT_VIDEO
    driver.find_element_by_id(input_id).click()
    paste(driver)
    t = driver.find_element_by_id(COMMENT_EDIT_TEXT).text
    driver.find_element_by_id(COMMENT_SEND_CANCEL).click()
    return t == content
Beispiel #2
0
 def get_video_time(self):
     try:
         if not element_exsist(self.driver, 'id', VIDEO_TIME):
             print 'click'
             self.driver.find_element_by_id(VIDEO_ITEM).click()
         t = self.driver.find_element_by_id(VIDEO_TIME).text
         print t
         self.video_time = t
         return True
     except Exception, e:
         pass
Beispiel #3
0
 def get_video_time3(self):
     try:
         if not element_exsist(self.driver, 'id', VIDEO_TIME):
             self.driver.find_element_by_id(VIDEO_ITEM).click()
         t = self.driver.find_elements_by_class_name(
             'android.support.v7.widget.AppCompatTextView')
         for i in t:
             print i.text, i._id
         return False
     except Exception, e:
         print e.__repr__()
         pass
Beispiel #4
0
def send_comment(driver, content, in_page=True):
    result = -1
    try:
        content = content.decode('utf-8')
    except:
        pass
    try:
        input_id = COMMENT_INPUT
        if element_exsist(driver, 'id', COMMENT_INPUT_VIDEO):
            input_id = COMMENT_INPUT_VIDEO
        driver.find_element_by_id(input_id).click()
        driver.find_element_by_id(COMMENT_EDIT_TEXT).send_keys(content)
        driver.find_element_by_id(COMMENT_SEND_OK).click()
        result = 1
    except Exception as e:
        print 'send_comment_error:', e
        result = 0
    finally:
        return result
Beispiel #5
0
 def start_pause_video(self):
     if not element_exsist(self.driver, 'id', VIDEO_TIME):
         self.driver.find_element_by_id(VIDEO_ITEM).click()
     self.driver.find_element_by_id(VIDEO_START_PAUSE).click()
     return True