Selenium Python TimeoutException:消息:''

时间:2014-09-09 19:07:43

标签: python selenium

我在确定导致此超时异常的确切原因时遇到问题。这是我的代码:

class EntertainmentSocialMedia(CoreTest):
def testEntertainmentTwitter(self):
    d = self.driver.getDriver()
    d.get(config.host_url + '/thewire')

    interstitial = True

    while interstitial == True:
        try:
            interstitial_link = WebDriverWait(d, 10).until(
                EC.presence_of_element_located((By.CSS_SELECTOR, "#interstitial-link"))
                ).click()
            interstitial = False
        except NoSuchElementException:
            interstitial = False


    print "Locating Entertainment vertical social share button"
    frame = WebDriverWait(d, 30).until(
        EC.presence_of_element_located((By.ID, "twitter-widget-0"))
    )

当我尝试这个时,我会得到相同的结果。

class EntertainmentSocialMedia(CoreTest):
    def testEntertainmentTwitter(self):
        d = self.driver.getDriver()
        d.get(config.host_url + '/thewire')
        try:
            frame = WebDriverWait(d, 10).until(
            EC.presence_of_element_located((By.CSS_SELECTOR, "#interstitial-link"))
        ).click()       
        except NoSuchElementException:
            print "No Welcome ad"


        print "Locating Entertainment vertical social share button"
        frame = WebDriverWait(d, 30).until(
            EC.presence_of_element_located((By.CSS_SELECTOR, "#l"))
        )

我一定错过了什么!

0 个答案:

没有答案