Python webdriver Htmlunit // Find_element_by_id让我错误

时间:2016-02-02 16:28:50

标签: javascript python selenium paypal htmlunit-driver

我想在paypal上Find_element_by_id以确认结帐,但我收到了错误消息。 我使用webdriver Chrome和Opera的工作代码:

confirmButton = browser.wait.until(
  EC.presence_of_element_located((By.ID, "confirmButtonTop"))
)
confirmButton.click()

我想将其与HTMLUnitPhantomJS一起使用,但它不起作用。我尝试过使用不同的方法,但没有:

try:
  WebDriverWait(driver, delay).until(EC.presence_of_element_located(
    driver.find_element_by_id('confirmButtonTop'))
  )
  print "Page is driver!"
except TimeoutException:
  print "Loading took too much time!"

或:

confirmButton = driver.find_element_by_id("confirmButtonTop")
confirmButton.click()

同样的错误:

  

无法找到ID为:confirmButtonTop

的元素

HTML:

<div id="button" class="buttons reviewButton">
  <input track-submit="" type="submit" value="Continuer" id="confirmButtonTop" 
         class="btn full confirmButton continueButton" validate-submit="onPay()">
</div>

0 个答案:

没有答案