Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]How to get the text of an element? #4853

Closed
dld8888 opened this issue Dec 30, 2020 · 2 comments
Closed

[Question]How to get the text of an element? #4853

dld8888 opened this issue Dec 30, 2020 · 2 comments

Comments

@dld8888
Copy link

dld8888 commented Dec 30, 2020

playwright python
" <td clospan="4" value="abcd">abcdefg </td> "

frame=page.querySelector('//iframe[contains(@src,"jktj/tolist")]').contentFrame()
txt=frame.getAttribute('input[value="abcd"]', 'text',2000)
print('text:',txt) =>result text: None

I'm sure the frame is right.
If I look for "value", I can find:
val=frame.getAttribute('input[value="abcd"]', 'value',2000)
print('val:',txt) =>result val:abcd
thank you

@dld8888
Copy link
Author

dld8888 commented Dec 30, 2020

txt=ff.innerTex('input[value="abcd"]')
print('text:',txt)
result text: abcdefg

1 similar comment
@dld8888
Copy link
Author

dld8888 commented Dec 30, 2020

txt=ff.innerTex('input[value="abcd"]')
print('text:',txt)
result text: abcdefg

@dld8888 dld8888 closed this as completed Dec 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant