英文:
Need to click text entering area before enter text successfully in selenium python
问题
I need to entering text in a text entering area. my command is:
self.driver.find_element_by_xpath(f"{self.plateId_input}").send_keys(plateId)
but I have found out issue this command does not work. I have to issue the same command twice. The first time is to click the text area, so the area is ready then issue the command and the text is entered successfully. My question is is there other way to perform this task? issue the command twice does not seems like a good practice.
英文:
I need to entering text in a text entering area. my command is:
self.driver.find_element_by_xpath(f"{self.plateId_input}").send_keys(plateId)
but I have found out issue this command does not work. I have to issue the same command twice. The first time is to click the text area, so the area is ready then issue the command and the text is entered successfully. My question is is there other way to perform this task? issue the command twice does not seems like a good practice.
答案1
得分: 2
element = self.driver.find_element_by_xpath(self.plateId_input)
element.click()
element.send_keys(plateId)
英文:
element = self.driver.find_element_by_xpath(self.plateId_input)
element.click()
element.send_keys(plateId)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论