I want to input "apple" instead of "hello" using Selenium in Python.
<span><div class="top1"><div class="top2"><label class="top3">
<label class="check"><input class="word" type="text" value="hello"></label>
How to do it?
Thank you very much.
I want to input "apple" instead of "hello" using Selenium in Python.
<span><div class="top1"><div class="top2"><label class="top3">
<label class="check"><input class="word" type="text" value="hello"></label>
How to do it?
Thank you very much.
As per the HTML you have provided, to send the text apple within the <input> element you can use the following code block :
driver.find_element_by_xpath("//label[@class='check']/input[@class='word' and @type='text' and @value='hello']").click()
driver.find_element_by_xpath("//label[@class='check']/input[@class='word' and @type='text' and @value='hello']").clear()
driver.find_element_by_xpath("//label[@class='check']/input[@class='word' and @type='text' and @value='hello']").send_keys("apple")
Before asking elementary questions like this, please read documentation for tools which you are using. You can find documentation via Google.
About your task. First, you need find your input in source code, than clean value and input a new one.
your_input = driver.find_element_by_xpath('xpath to your input')
your_input.clear()
your_input.send_keys('your new text')