selenium-wire icon indicating copy to clipboard operation
selenium-wire copied to clipboard

Error finding page element using selenium wire

Open JLX120 opened this issue 3 years ago • 6 comments

Hello, when I wanted to use selenium wire to find page elements, I encountered a problem. I don't know why? When I use find_ When elements looks for page elements, it returns the results I found, but when I send the data to be filled in, it prompts me "element not interactive", and sometimes it does find and send the data I want to fill in. Why can't I find it, so I want to ask you? image image

JLX120 avatar Jan 03 '22 07:01 JLX120

If you switch to using selenium directly (no selenium wire), do you still get the same problem?

wkeeling avatar Jan 03 '22 10:01 wkeeling

如果你直接改用selenium(没有selenium 线),你还会遇到同样的问题吗?

This will not happen when using selenium directly, but because the website I want to visit must use a dynamic proxy, I use selenium wire to configure dynamic proxy access and then find elements

JLX120 avatar Jan 03 '22 14:01 JLX120

I don't know why selenium wire would cause that to happen, although it might the indirect result of latency introduced by request capture.

It seems as though the div element is not ready at the point you try to send data to it. Have you tried explicitly waiting until the element is visible?

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

div = WebDriverWait(driver, 20).until(
    EC.visibility_of_element_located((By.XPATH, '//input[@class="quantumWizTextinputPaperinputInput exportInput"]'
)))

wkeeling avatar Jan 03 '22 15:01 wkeeling

我不知道为什么硒线会导致这种情况发生,尽管它_可能_是请求捕获引入的延迟的间接结果。

div在您尝试向其发送数据时,该元素似乎尚未准备好。您是否尝试过显式等待元素可见?

来自 硒。网络驱动程序。常见的。由 进口 到
来自 硒。网络驱动程序。支持。ui 从selenium导入 WebDriverWait
。网络驱动程序。支持导入expected_conditions作为EC div = WebDriverWait ( driver , 20 )。直到(
     EC。visibility_of_element_located((通过。XPATH,     

  '//input[@class="quantumWizTextinputPaperinputInput exportInput"]' 
)))

I tried to wait invisibly, but it still has the same error prompt "element not interactive". I don't know why it sometimes sends data and sometimes doesn't send data? image

JLX120 avatar Jan 03 '22 16:01 JLX120

When I use display wait, it does find the element I want to find, but when I send data, it mostly fails and rarely succeeds

JLX120 avatar Jan 03 '22 16:01 JLX120

@JLX120 did you manage to resolve this in the end?

wkeeling avatar Jun 17 '22 14:06 wkeeling