'Python Selenium Actions into Playwirght
I'm trying to convert my code from selenium to playwright and having a hard time finding a solution on how to convert the actions from selenium to playwright.
Here is selenium code
dob = browser.find_element(By.XPATH, '//*[@name="dob"]')
actions = ActionChains(browser)
actions.click(dob)
actions.perform()
I need to convert this to playwight but it's not working.
This is what i've tried.
page.click('//*[@name="dob"]')
Also, tried, dblclick, focus nothing seems to work. When the browser clicks on this input field a few css changes happen in dom.
Solution 1:[1]
Playwright has a built in code generator which will make things easy for you.
Run this command and try it out
npx playwright codegen
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Spidy |