我试图点击按钮,然后等待页面加载。问题是我不知道如何告诉驱动程序等待,因为它必须在页面加载后搜索一些元素。
我认为我应该使用这样的东西:
wait.until(EC.invisibility_of_element_located...
但不知道如何让它发挥作用。
这是一段在页面加载后可见的 HTML。
<h1 class="special ng-binding">
Rezervácia letu
<strong class="js_log_fl_res ng-binding">Bratislava</strong> <span class="date js_log_fl_res ng-binding">14.07.2015</span> <strong class="js_log_fl_res ng-binding">Madrid</strong>
<!-- ngIf: computed.second && computed.first.toCode === computed.second.fromCode --><span ng-if="computed.second && computed.first.toCode === computed.second.fromCode" class="ng-scope">
<span class="date js_log_fl_res ng-binding">23.07.2015</span>
<strong class="js_log_fl_res ng-binding">Bratislava</strong>
</span><!-- end ngIf: computed.second && computed.first.toCode === computed.second.fromCode -->
<!-- ngIf: computed.second && computed.first.toCode !== computed.second.fromCode -->
</h1>
我想等到字符串“Rezervácia letu”没有出现在页面上。
你能给我一个提示吗?
最佳答案
invisibility_of_element_located()
有两个参数。您可以按如下方式使用它
WebDriverWait(driver, 10).until(
EC.invisibility_of_element_located((By.CSS_SELECTOR, "h1.special.ng-binding"))
Here是如何使用它的示例。
关于python - 等到元素不出现 - Selenium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31027005/