0

我想Find_element_by_id在贝宝上确认结帐,但我收到了一个错误。我使用带有 webdriver Chrome 和 Opera 的工作代码:

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

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

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>
4

0 回答 0