pythonのseleniumで検索文字列として、//[text()=”testtest”]/ancestor::[3]//buttonのように検索した後にancestor::[3]などのように記述することで親要素を辿ることができる created-2025/12/17 updated-2025/12/17