i'm using selenium with python to register into a website.
(我正在使用硒与python一起注册到网站。)
My problem is that when i need to insert the credit card number and the security number, though i copy the xpath of the field, wait for the field to be visible and clickable, python raise a timeout exception becouse he didn't find any field with that xpath. (我的问题是,当我需要插入信用卡号和安全号时,尽管我复制了字段的xpath,等待该字段可见且可点击,但是python引发了超时异常,因为他没有找到任何字段那个xpath。)
The html code of the field is that: (该字段的html代码是:)
<input id="cardnumber" autocomplete="cc-number" type="tel" pattern="[0-9]*" placeholder="1111 2222 3333 4444" data-encrypted-name="number" class="form-control">
UPDATE: Maybe I understand.
(更新:也许我明白。)
When I print out driver.page_source
I notice that it's not loaded properly, and now I understand why Selenium can't find nothing, neither by xpath, neither by name or everything. (当我打印出driver.page_source
我注意到它没有正确加载,现在我明白了为什么Selenium找不到任何东西,无论是通过xpath,通过名称还是全部都找不到。)
I notice that what is loaded can be clicked and all, but some fields are not loaded. (我注意到可以单击加载的全部内容,但是某些字段未加载。)
So why Selenium behave like that? (那么,硒为何如此表现呢?)
UPDATE AGAIN: Solved, the solution is that i need to switch iframe every time.
(再次更新:解决了,解决方法是我每次都需要切换iframe。)
ask by Gianla translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…