硒有问题。尝试解析一个网页并在运行时我的用户界面损坏,因此无法用文本填充字段(出现不可交互的错误)

总体外观如何
运行 selenium

消息:元素不可交互(会话信息:
chrome=99.0.4844.84) 堆栈跟踪:回溯:Ordinal0
[0x00BF9943+2595139]序数0 [0x00B8C9F1+2148849]序数0
[0x00A843F0+1065968]序数0 [0x00AAC4D3+1230035]序数0
[0x00AABB8B+1227659]序数0 [0x00ACB9EC+1358316]序数0
[0x00AA7474+1209460]序数0 [0x00ACBC04+1358852]序数0
[0x00ADBAF2+1424114]序数0 [0x00ACB806+1357830]序数0
[0x00AA6086+1204358] Ordinal0 [0x00AA6F96+1208214] GetHandleVerifier
[0x00D9B232+1658114] GetHandleVerifier [0x00E5312C+2411516]
GetHandleVerifier [0x00C8F261+560433] GetHandleVerifier
[0x00C8E366+556598]序数0 [0x00B9286B+2173035]序数0
[0x00B975F8+2192888]序数0 [0x00B976E5+2193125]序数0
[0x00BA11FC+2232828]BaseThreadInitThunk[0x773EFA29+25]
RtlGetAppContainerNamedObjectPath [0x77AA7A7E+286]
RtlGetAppContainerNamedObjectPath [0x77AA7A4E+238]
我的代码:
url = "https://opi.dfo.kz/p/ru/archive-publication/corporative-events-2020-14-07"
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get(url)
element = driver.find_element(By.XPATH, '//*[@id="CorporativeEvents20201407"]/div[1]/div[1]/div/div[2]/div[1]/span[3]')
element.send_keys('010140000143')
请帮助我!
having trouble with selenium. Trying to parse one webpage and while running it Im having broken UI, therefore couldn't fill fields with text(getting error not interactable)

how it looks in general
what i have after running selenium

Message: element not interactable (Session info:
chrome=99.0.4844.84) Stacktrace: Backtrace: Ordinal0
[0x00BF9943+2595139] Ordinal0 [0x00B8C9F1+2148849] Ordinal0
[0x00A843F0+1065968] Ordinal0 [0x00AAC4D3+1230035] Ordinal0
[0x00AABB8B+1227659] Ordinal0 [0x00ACB9EC+1358316] Ordinal0
[0x00AA7474+1209460] Ordinal0 [0x00ACBC04+1358852] Ordinal0
[0x00ADBAF2+1424114] Ordinal0 [0x00ACB806+1357830] Ordinal0
[0x00AA6086+1204358] Ordinal0 [0x00AA6F96+1208214] GetHandleVerifier
[0x00D9B232+1658114] GetHandleVerifier [0x00E5312C+2411516]
GetHandleVerifier [0x00C8F261+560433] GetHandleVerifier
[0x00C8E366+556598] Ordinal0 [0x00B9286B+2173035] Ordinal0
[0x00B975F8+2192888] Ordinal0 [0x00B976E5+2193125] Ordinal0
[0x00BA11FC+2232828] BaseThreadInitThunk [0x773EFA29+25]
RtlGetAppContainerNamedObjectPath [0x77AA7A7E+286]
RtlGetAppContainerNamedObjectPath [0x77AA7A4E+238]
my code:
url = "https://opi.dfo.kz/p/ru/archive-publication/corporative-events-2020-14-07"
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get(url)
element = driver.find_element(By.XPATH, '//*[@id="CorporativeEvents20201407"]/div[1]/div[1]/div/div[2]/div[1]/span[3]')
element.send_keys('010140000143')
Please help me!
您无法直接向该元素发送文本。
您应该单击该元素,这将打开另一个
input
元素,您可以在其中插入文本输入。此外,您还必须在此处使用预期条件显式等待。
这有效:
'//*[@id="CorporativeEvents20201407"]/div[1]/div[1]/div/div[2]/div[1]/span[3]'
XPath 定位器也可以而且应该得到改进。您可以使用//div[@class='logic-group-condition' 和 .//span[@field-name='tbOpiActiveRevisions_flBin']]
代替。这个定位器更加可靠。所以你的代码将是:这是应用我的代码后网页的屏幕截图:

You can not send text directly to that element.
You should click on that element, this will open another
input
element where you will be able to insert your text input.Also you have to use Expected Conditions explicit waits here.
This works:
The
'//*[@id="CorporativeEvents20201407"]/div[1]/div[1]/div/div[2]/div[1]/span[3]'
XPath locator can and should be improved as well. You can use//div[@class='logic-group-condition' and .//span[@field-name='tbOpiActiveRevisions_flBin']]
Instead. This locator is much more reliable. So your code will be:This is the screen shot of the web page after applying my code:
