Open miltonvo opened 10 months ago
Thanks for submitting this issue. I'm working on a cross-platform patch for this. Still will take some time tho:)
can be used for selecting elements (headfull is undetectable only) for now. Will be implementing it propperly at some point
usage:
from cdp_patches.input import AsyncInput
from selenium_driverless.types.by import By
# other imports, setting up driver etc...
async_input = await AsyncInput(browser=driver)
select_elem = await driver.find_element(By.XPATH, '//select[@id="animals') # or the respective query for finding the element
await select(select_elem, value="dog", async_input=async_input) # or text="Dog"
as now, select dropdowns are broken due to crbug#1503393. You can use something like the following for that:
value = "audi"
select = await driver.find_element(By.XPATH, '//select[@id="cars"]', timeout=5)
await asyncio.sleep(1)
await select.execute_script('''
var evt = new Event("change")
evt.initEvent("change", true, true)
obj.value = arguments[0]
obj.dispatchEvent(evt)
''', value)
where the value is the value for the specified option (doesn't have to be same as the text!) (source page for image)
Note: While this works, it's easely detectable.
Excelent, thanks
solved with simulating sending keys and write value with javascript :)
@miltonvo can you explain more about your solution ?
I'm having the same problem here
example
driver.execute_script("document.getElementById('FIND ELEMENT').value = arguments[0]", Your Argument)
example
driver.execute_script("document.getElementById('FIND ELEMENT').value = arguments[0]", Your Argument)
you can pass WebElements as an argument directly as well. Any js like that will be detectable tho.
Yeah, it doesn't work, changing the value or innerhtml even though the appearing text change it doesn't update the button that is disabled without a value
Hi friends, this is what worked for me
dropdown_element = driver.find_element(By.XPATH, "FIND ELEMENT") # find the dropdown
dropdown_element.click() # click the dropdown
driver.execute_script(f"arguments[0].value = '{random.randint(1, 12)}';", dropdown_element) # I choose a random element
driver.execute_script("arguments[0].dispatchEvent(new Event('change', { bubbles: true }));", dropdown_element) # I confirm the selection of the item
Hi friends, this is what worked for me
dropdown_element = driver.find_element(By.XPATH, "FIND ELEMENT") # find the dropdown dropdown_element.click() # click the dropdown driver.execute_script(f"arguments[0].value = '{random.randint(1, 12)}';", dropdown_element) # I choose a random element driver.execute_script("arguments[0].dispatchEvent(new Event('change', { bubbles: true }));", dropdown_element) # I confirm the selection of the item
Yeah "works" sure. But detectable as well.
Excelent, thanks
solved with simulating sending keys and write value with javascript :)
Could you share the solution? I'm interested as well :)
any undetectable solution?
Hi for all
im trying to find this input field:
and then write some value
i see the script writing on field the value but if i click on another place the value disappears
thanks for if someone can helps to solve this