<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>kuku81kuku81</author_name>
  <author_url>https://blog.hatena.ne.jp/kuku81kuku81/</author_url>
  <blog_title>Django Girls and Boys 備忘録</blog_title>
  <blog_url>https://kuku81kuku81.hatenablog.com/</blog_url>
  <categories>
    <anon>Python</anon>
    <anon>selenium</anon>
  </categories>
  <description>pythonのseleniumで要素の取得をする場合は、find_element、またはfind_elementsで取得できます。 find_elementの場合は、たとえば以下のようになります。 element = driver.find_element(By.NAME, &quot;tagname&quot;) このようにして取得した要素elementから１階層上の要素（親要素）を取得したいような場合があるかと思います。 そのような場合にはxpathを使用して以下のようにします。 element.find_element(By.XPATH, &quot;..&quot;) 同様に、２階層上の要素を取得するような場合には以下のよう…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fkuku81kuku81.hatenablog.com%2Fentry%2F2023%2F12%2F30_Python_Selenium_how_to_get_the_parent_element&quot; title=&quot;【Python Selenium】要素の親要素を取得する方法 - Django Girls and Boys 備忘録&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/k/kuku81kuku81/20220605/20220605115219.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2023-12-30 19:00:00</published>
  <title>【Python Selenium】要素の親要素を取得する方法</title>
  <type>rich</type>
  <url>https://kuku81kuku81.hatenablog.com/entry/2023/12/30_Python_Selenium_how_to_get_the_parent_element</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
