Closed snja closed 8 months ago
import asyncio
from ichrome import AsyncChromeDaemon
async def main():
async with AsyncChromeDaemon() as chrome:
async with chrome.incognito_tab() as tab:
await tab.goto("https://httpbin.org/forms/post", timeout=5)
# print(await tab.html)
tag = await tab.querySelector('[name="custname"]', 'value = "123"')
await asyncio.sleep(0.5)
await tab.alert(
"watch the Customer name input node %s, %s" % (tag, tag.to_dict()),
timeout=1000,
)
await asyncio.sleep(3)
asyncio.run(main())
see the demo, you need to make sure the #newUserCountry
node is input tag, or you need tab.js
run original JS code instead.
i will change value of selectbox
selector select#newUserCountry
try await tab.js("original Javascript")
tag_region_sel = "#newUserCountry"
await self.tab.querySelector(tag_region_sel, "value = 'US'")
after submit value not changed