【发布时间】:2020-08-14 10:15:59
【问题描述】:
我尝试将电话号码发送到下面的输入元素
<div id="mainframe.childframe.form.div_main.form.div_work.form.edt_mbtlTelNoCentral" class="Edit" tabindex="-1" style="left:309px;top:305px;width:85px;height:28px;" aria-label="휴대전화 가운데자리(필수입력) " aria-description="" userstatus="" status="enabled"><input id="mainframe.childframe.form.div_main.form.div_work.form.edt_mbtlTelNoCentral:input" class="nexainput" style="left:0px;top:0px;width:83px;height:26px;ime-mode:disabled;" value="" maxlength="4" type="text"><input id="mainframe.childframe.form.div_main.form.div_work.form.edt_mbtlTelNoCentral:input" class="nexainput" style="left:0px;top:0px;width:83px;height:26px;ime-mode:disabled;" value="" maxlength="4" type="text"></div>
使用此代码
actions = ActionChains(driver)
ele = driver.find_element_by_xpath('//*[@maxlength="4"]')
actions.click(ele).key_down(Keys.CONTROL).send_keys("a").key_up(Keys.CONTROL).send_keys("Keys.Delete").send_keys('9049').perform()
但它保持这样的发送密钥 enter image description here
我该如何解决这个问题?
【问题讨论】:
-
您是否尝试过直接将密钥发送到元素?
ele.send_keys("9049") -
@BendikKnapstad 是的,但没用
-
你想使用哪个页面?
-
@BendikKnapstadhttps://www.ehaneul.go.kr:5443/esky_p/esky_index.jsp#MENU:M211002000 这里是韩国网站
-
抱歉,页面要我下载一些东西。这不会发生
标签: python python-3.x selenium web web-crawler