Closed garyzhang21 closed 1 year ago
and it is ant design picker for the locator.
@garyzhang21 what do you mean by "not working well"? What kind of error does it give you?
@garyzhang21 what do you mean by "not working well"? What kind of error does it give you?
no error, and no actions when i want to click the label 2534,it is still 2536 displayed in the screenshot.
Can you provide a repro like a small code snippet which we can run locally?
Playwright performs accessibility checks, so its more like what a real user does instead of just clicking immediately on the element. You should see a error reported why the click is not working, see also here about debugging: https://playwright.dev/python/docs/debug
i tried. from this picture you can see i already request click function, and it passed, but it does not click the locator that i want.
I see i already got the reason why not clickable. it is because of not compatible for my component. btw. actually i set the phone model. and my component is ant design picker for mobile. and if i open the develop tool to select phone again, i can click , so any solution for this point ? here is my code to set up the device of phone: if phone !=None: iphone = p.devices[phone] context = browser.new_context(**iphone) page = context.new_page()
{'user_agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Mobile/15E148 Safari/604.1', 'viewport': {'width': 428, 'height': 746}, 'device_scale_factor': 3, 'is_mobile': True, 'has_touch': True, 'default_browser_type': 'webkit'}
this is the detail of iphone.
chrome version : \chromium-1045\chrome-win\chrome.exe> version=110.0.5481.38>
As you can see in the screenshot there are two elements with the selector. We recommend using Locators, since they are strict, and throw if the selector does not resolve to 1 element. Maybe you are clicking on the wrong element?
See here about how to debug selectors: https://playwright.dev/python/docs/debug-selectors
As you can see in the screenshot there are two elements with the selector. We recommend using Locators, since they are strict, and throw if the selector does not resolve to 1 element. Maybe you are clicking on the wrong element?
See here about how to debug selectors: https://playwright.dev/python/docs/debug-selectors
you can see that i click the element that xpath is //*[text()='2534']
but from the screenshot 2534 can not be selected.
and i found the reason. it is because of not compatible for my component.
btw. actually i set the phone model. and my component is ant design picker for mobile. and if i open the develop tool to select phone again, i can click , so any solution for this point ?
here is my code to set up the device of phone: if phone !=None: iphone = p.devices[phone] context = browser.new_context(**iphone) page = context.new_page()
and here is the iphone print: {'user_agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.4 Mobile/15E148 Safari/604.1', 'viewport': {'width': 428, 'height': 746}, 'device_scale_factor': 3, 'is_mobile': True, 'has_touch': True, 'default_browser_type': 'webkit'}
and i found the reason. it is because of not compatible for my component.
@garyzhang21 Glad to here the issue is resolved. Closing this then.
Do not hesitate to file more issues if you think this we can be helpful though. We will appreciate if you follow issue template next time. Thanks!
Your question
i used the xpath //*[text()='2534'] , but i found click action not working well. but actually it works by selenium what should i do?