{"id":52,"date":"2022-10-27T00:51:52","date_gmt":"2022-10-26T16:51:52","guid":{"rendered":"https:\/\/mianka.xyz\/?p=50"},"modified":"2022-10-27T00:53:48","modified_gmt":"2022-10-26T16:53:48","slug":"python-selenium-findelementbyxpath","status":"publish","type":"post","link":"https:\/\/www.mianka.xyz\/?p=52","title":{"rendered":"python selenium find_element_by_xpath \u65b9\u6cd5\u5df2\u7ecf\u88ab\u5f03\u7528\u7684\u89e3\u51b3\u529e\u6cd5"},"content":{"rendered":"<p>\u80cc\u666f\uff1a<\/p>\n<p><\/p>\n<p>\u5728\u4f7f\u7528\u6700\u65b03.10.4Python\u7248\u672c\u65f6\u5019\uff0c\u7528selenium\u8fdb\u884cxpath\u5b9a\u4f4d\u5143\u7d20\uff0c\u7f16\u8bd1\u5668\u63d0\u793a\uff1a<\/p>\n<p><\/p>\n<p>DeprecationWarning:<\/p>\n<p><\/p>\n<p>find_element_by_xpath is deprecated. Please use find_element(by=By.XPATH, value=xpath) instead driver.find_element_by_xpath(&#39;\/\/*[@id=&quot;app&quot;]\/section\/main\/div\/button[1]&#39;).click()<\/p>\n<p><\/p>\n<p>find_element_by_xpath \u65b9\u6cd5\u5df2\u7ecf\u88ab\u5f03\u7528\uff0c\u8bf7\u4f7f\u7528\u65b0\u7684\u5bfc\u5165By\u5305\u7684\u65b9\u6cd5\uff0c\u8fd9\u91cc\u7b80\u5355\u8bb0\u4e00\u4e0b\u5bfc\u5165By\u5305\u540e\u5982\u4f55\u4f7f\u7528\u65b0\u7684\u65b9\u6cd5\u8fdb\u884cxpath\u5b9a\u4f4d<\/p>\n<p><\/p>\n<p>1.\u5bfc\u5165by\u5305\uff1a<\/p>\n<p><\/p>\n<p>from selenium.webdriver.common.by import By<\/p>\n<p><\/p>\n<p>By\u7c7b\u7684\u65b9\u6cd5\uff1a<\/p>\n<p>1.find_element(By.XPATH, \u2018xpath\u8def\u5f84\u2019)<\/p>\n<p>2.\u9700\u8981\u4e24\u4e2a\u53c2\u6570\uff0c\u7b2c\u4e00\u4e2a\u53c2\u6570\u4e3a\u5b9a\u4f4d\u7684\u7c7b\u578b\uff0c\u7531By\u63d0\u4f9b\uff0c\u7b2c\u4e8c\u4e2a\u53c2\u6570\u4e3a\u5b9a\u4f4d\u7684\u5177\u4f53\u65b9\u5f0f\u503c<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f\uff1a<\/p>\n<p><\/p>\n<p>\u5728\u4f7f\u7528\u6700\u65b03.10.4Python\u7248\u672c\u65f6\u5019\uff0c\u7528selenium\u8fdb\u884cxpath\u5b9a\u4f4d\u5143\u7d20\uff0c\u7f16\u8bd1\u5668\u63d0\u793a\uff1a<\/p>\n<p><\/p>\n<p>DeprecationWarning:<\/p>\n<p><\/p>\n<p>find_element_by_xpath is deprecated. Please use find_element(by=By.XPATH, value=xpath) instead driver.find_element_by_xpath(&#39;\/\/*[@id=&quot;app&quot;]\/section\/main\/div\/button[1]&#39;).click()<\/p>\n<p><!--autointro--><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[15,18],"class_list":["post-52","post","type-post","status-publish","format-standard","hentry","category-pythonbiji","tag-python","tag-selenium"],"_links":{"self":[{"href":"https:\/\/www.mianka.xyz\/index.php?rest_route=\/wp\/v2\/posts\/52","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mianka.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mianka.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mianka.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mianka.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=52"}],"version-history":[{"count":0,"href":"https:\/\/www.mianka.xyz\/index.php?rest_route=\/wp\/v2\/posts\/52\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mianka.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mianka.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mianka.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}