提问人:Jeff Gordon 提问时间:10/31/2023 最后编辑:Jeff Gordon 更新时间:11/1/2023 访问量:31
无法找到硒的多部门按钮的可点击网站元素
Trouble locating the clickable website element for a multidivisional button for selenium
问:
我有一个表面的HTML,所以请和我一起选择我的单词,并随时在评论中批评以提高问题的清晰度。
我正在尝试使用 Selenium webdriver 和 Python 单击一个按钮。它是可见的,但我无法弄清楚在 HTML 中选择哪个元素。我一直在右键单击,点击页面可见元素上的检查元素,然后找到要与任何一个或一起使用的相应元素,但在这种情况下,我一直无法找到要单击的元素。当我单击检查元素时,这个按钮似乎比我遇到的其他按钮更复杂,并且出现在屏幕上的按钮在 HTML 中有几个分区。我附上了 GUI 视图中的样子:By.ID
By.CLASS
我无法链接整个网站,因为它需要用户名和密码,但下面是网站上感兴趣的按钮的 HTML 片段如下:
</div></div></div>
<div style='' class='content-item content-sub_section item-2 margin-b-2x flex flex-row ' NAME='BASE_REF' BASE_REF='D_PortalTiles.PortalTiles(2)' data-test-id='202006181513580955512-2' STRING_TYPE='sub_section' RESERVE_SPACE='false'>
<div class='sectionDivStyle ' style='' id='RULE_KEY' node_type='MAIN_RULE' node_name='PortalTiles' data-node-id='PortalTiles' version='1' objclass='Rule-HTML-Section' pyclassname='NJJ-Data-' readonly='false' NAME='BASE_REF' BASE_REF='' expandRL='true' INDEX='2' uniqueID='SID1698765168490' >
<div id="CT" SWP=".IsSubMenu,.App_order,.App_ID" SHOW_WHEN=".IsSubMenu != true && .App_order!=-1 && .App_ID != 'AOCMF'" data-simplelayout = "true" style=' '>
<div class='layout layout-noheader layout-noheader-all_cases_tile has-action '>
<div section_index='2' class=' layout-body'>
<div bSimpleLayout='true' class='flex content pointer layout-content-simple_list_fixed content-simple_list_fixed margin-b-2x' data-click='[["runScript", ["launchNewBrowserTab(\"#~D_PortalTiles.PortalTiles(2).AppHomeURL~#\")"]]]' >
<div style='' class='content-item content-layout item-1 remove-top-spacing remove-left-spacing remove-right-spacing flex flex-row ' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-inline content-inline width-100-pct padding-1x fixed-height-40 nowrap' >
<div style='' class='content-item content-layout item-1 remove-top-spacing remove-left-spacing flex flex-row ' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-default content-default fixed-height-40' >
<div style='' class='content-item content-label item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing width-100-pct left-aligned dataLabelWrite tile_label_dataLabelWrite flex flex-row ' data-test-id='20200511150809067558141' STRING_TYPE='label' RESERVE_SPACE='false'>eCourts</div>
</div>
</div>
</div>
</div>
<div style='' class='content-item content-layout item-2 remove-bottom-spacing remove-right-spacing flex flex-row align-end' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-default content-default ' >
<div id="CT" SWP=".IsSubMenu" SHOW_WHEN=".IsSubMenu=='true'" style='display:none; ' class='content-item content-field item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing color-primary dataValueWrite flex flex-row ' STRING_TYPE='field' RESERVE_SPACE='false'><span ><i data-test-id='20200629171622057167999' href='' onclick='pd(event);' data-ctl='Icon' class=' icons fas fa-ellipsis-v' tabindex='0' role='link' name='PortalTiles_D_PortalTiles.PortalTiles(2)_23' alt= '' data-click='[["showMenu",[{"dataSource":"TileSubMenu", "isNavNLDeferLoaded":"false", "isNavTypeCustom":"false", "className":"NJJ-Data-","menuAlign":"left","format":"menu-format-standard-tabbed" , "loadBehavior":"ondisplay", "ellipsisAfter":"999","usingPage":"D_PortalTiles.PortalTiles(2)", "useNewMenu":"true", "isMobile":"false", "navPageName":"pyNavigation1677611935770"},":event"]]]' ></i></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style='' class='content-item content-layout item-2 remove-top-spacing remove-left-spacing remove-right-spacing flex flex-row ' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-stacked content-stacked width-100-pct centered padding-1x fixed-height-108' >
<div style='' class='content-item content-field item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing tile-icon width-100-pct centered dataValueWrite flex flex-row ' STRING_TYPE='field' RESERVE_SPACE='false'><span ><i data-test-id='20200511150809067661321' href='' onclick='pd(event);' data-ctl='Icon' class='cursordefault icons far fa-file-signature' name='PortalTiles_D_PortalTiles.PortalTiles(2)_26' alt= '' ></i></span></div>
</div>
</div>
</div>
</div>
<div style='' class='content-item content-layout item-3 remove-top-spacing remove-left-spacing remove-right-spacing flex flex-row align-end' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-inline content-inline width-100-pct padding-r-1x fixed-height-40' >
<div style='' class='content-item content-layout item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing flex flex-row align-end' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-default content-default ' >
<div style='' class='content-item content-field item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing label-color dataValueWrite flex flex-row ' STRING_TYPE='field' RESERVE_SPACE='true'><span ><i data-test-id='20200511150809067764740' href='' onclick='pd(event);' data-ctl='Icon' class='cursordefault icons far fa-external-link' name='PortalTiles_D_PortalTiles.PortalTiles(2)_31' title= 'Opens in new browser tab ' alt= 'Opens in new browser tab ' ></i></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="CT" SWP=".IsSubMenu,.App_order" SHOW_WHEN=".IsSubMenu=='true' && .App_order!=-1" data-simplelayout = "true" style='display:none; '>
<div class='layout layout-noheader layout-noheader-all_cases_tile has-action '>
<div section_index='3' class=' layout-body'>
<div bSimpleLayout='true' class='flex content pointer layout-content-simple_list_fixed content-simple_list_fixed margin-b-2x' data-click='[["showMenu",[{"dataSource":"TileSubMenu", "isNavNLDeferLoaded":"false", "isNavTypeCustom":"false", "className":"NJJ-Data-","menuAlign":"left","format":"menu-format-standard-tabbed" , "loadBehavior":"ondisplay", "ellipsisAfter":"999","usingPage":"D_PortalTiles.PortalTiles(2)", "useNewMenu":"true", "isMobile":"false", "navPageName":"pyNavigation1677611935818"},":event"]]]' >
<div style='' class='content-item content-layout item-1 remove-top-spacing remove-left-spacing remove-right-spacing flex flex-row ' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-inline content-inline width-100-pct padding-1x fixed-height-40 nowrap' >
<div style='' class='content-item content-layout item-1 remove-top-spacing remove-left-spacing flex flex-row ' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-default content-default fixed-height-40' >
<div style='' class='content-item content-label item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing width-100-pct left-aligned dataLabelWrite tile_label_dataLabelWrite flex flex-row ' data-test-id='20200511150809067558141' STRING_TYPE='label' RESERVE_SPACE='false'>eCourts</div>
</div>
</div>
</div>
</div>
<div style='' class='content-item content-layout item-2 remove-bottom-spacing remove-right-spacing flex flex-row align-end' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-default content-default ' >
<div id="CT" SWP=".IsSubMenu" SHOW_WHEN=".IsSubMenu=='true'" style='display:none; ' class='content-item content-field item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing color-primary dataValueWrite flex flex-row ' STRING_TYPE='field' RESERVE_SPACE='false'><span ><i data-test-id='20200629171622057167999' href='' onclick='pd(event);' data-ctl='Icon' class=' icons fas fa-ellipsis-v' tabindex='0' role='link' name='PortalTiles_D_PortalTiles.PortalTiles(2)_40' alt= '' data-click='[["showMenu",[{"dataSource":"TileSubMenu", "isNavNLDeferLoaded":"false", "isNavTypeCustom":"false", "className":"NJJ-Data-","menuAlign":"left","format":"menu-format-standard-tabbed" , "loadBehavior":"ondisplay", "ellipsisAfter":"999","usingPage":"D_PortalTiles.PortalTiles(2)", "useNewMenu":"true", "isMobile":"false", "navPageName":"pyNavigation1677611935842"},":event"]]]' ></i></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style='' class='content-item content-layout item-2 remove-top-spacing remove-left-spacing remove-right-spacing flex flex-row ' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-stacked content-stacked width-100-pct centered padding-1x fixed-height-108' >
<div style='' class='content-item content-field item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing tile-icon width-100-pct centered dataValueWrite flex flex-row ' STRING_TYPE='field' RESERVE_SPACE='false'><span ><i data-test-id='20200511150809067661321' href='' onclick='pd(event);' data-ctl='Icon' class='cursordefault icons far fa-file-signature' name='PortalTiles_D_PortalTiles.PortalTiles(2)_43' alt= '' ></i></span></div>
</div>
</div>
</div>
</div>
<div style='' class='content-item content-layout item-3 remove-top-spacing remove-left-spacing remove-right-spacing flex flex-row align-end' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-inline content-inline width-100-pct padding-r-1x fixed-height-40' >
<div style='' class='content-item content-layout item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing flex flex-row align-end' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-default content-default ' >
<div style='' class='content-item content-field item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing label-color dataValueWrite flex flex-row ' STRING_TYPE='field' RESERVE_SPACE='true'><span ><i data-test-id='20200511150809067764740' href='' onclick='pd(event);' data-ctl='Icon' class='cursordefault icons far fa-external-link' name='PortalTiles_D_PortalTiles.PortalTiles(2)_48' title= 'Opens in new browser tab ' alt= 'Opens in new browser tab ' ></i></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="CT" SWP=".IsSubMenu,.App_order,.App_ID" SHOW_WHEN=".IsSubMenu != true && .App_order!=-1 && .App_ID = 'AOCMF'" data-simplelayout = "true" style='display:none; '>
<div class='layout layout-noheader layout-noheader-all_cases_tile has-action '>
<div section_index='4' class=' layout-body'>
<div bSimpleLayout='true' class='flex content pointer layout-content-simple_list_fixed content-simple_list_fixed margin-b-2x' data-click='[["runScript", ["OpenEntPortalTerminalEmulation()"]]]' >
<div style='' class='content-item content-layout item-1 remove-top-spacing remove-left-spacing remove-right-spacing flex flex-row ' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-inline content-inline width-100-pct padding-1x fixed-height-40 nowrap' >
<div style='' class='content-item content-layout item-1 remove-top-spacing remove-left-spacing flex flex-row ' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-default content-default fixed-height-40' >
<div style='' class='content-item content-label item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing width-100-pct left-aligned dataLabelWrite tile_label_dataLabelWrite flex flex-row ' data-test-id='20200511150809067558141' STRING_TYPE='label' RESERVE_SPACE='false'>eCourts</div>
</div>
</div>
</div>
</div>
<div style='' class='content-item content-layout item-2 remove-bottom-spacing remove-right-spacing flex flex-row align-end' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-default content-default ' >
<div id="CT" SWP=".IsSubMenu" SHOW_WHEN=".IsSubMenu=='true'" style='display:none; ' class='content-item content-field item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing color-primary dataValueWrite flex flex-row ' STRING_TYPE='field' RESERVE_SPACE='false'><span ><i data-test-id='20200629171622057167999' href='' onclick='pd(event);' data-ctl='Icon' class=' icons fas fa-ellipsis-v' tabindex='0' role='link' name='PortalTiles_D_PortalTiles.PortalTiles(2)_57' alt= '' data-click='[["showMenu",[{"dataSource":"TileSubMenu", "isNavNLDeferLoaded":"false", "isNavTypeCustom":"false", "className":"NJJ-Data-","menuAlign":"left","format":"menu-format-standard-tabbed" , "loadBehavior":"ondisplay", "ellipsisAfter":"999","usingPage":"D_PortalTiles.PortalTiles(2)", "useNewMenu":"true", "isMobile":"false", "navPageName":"pyNavigation1677611935910"},":event"]]]' ></i></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style='' class='content-item content-layout item-2 remove-top-spacing remove-left-spacing remove-right-spacing flex flex-row ' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-stacked content-stacked width-100-pct centered padding-1x fixed-height-108' >
<div style='' class='content-item content-field item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing tile-icon width-100-pct centered dataValueWrite flex flex-row ' STRING_TYPE='field' RESERVE_SPACE='false'><span ><i data-test-id='20200511150809067661321' href='' onclick='pd(event);' data-ctl='Icon' class='cursordefault icons far fa-file-signature' name='PortalTiles_D_PortalTiles.PortalTiles(2)_60' alt= '' ></i></span></div>
</div>
</div>
</div>
</div>
<div style='' class='content-item content-layout item-3 remove-top-spacing remove-left-spacing remove-right-spacing flex flex-row align-end' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-inline content-inline width-100-pct padding-r-1x fixed-height-40' >
<div style='' class='content-item content-layout item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing flex flex-row align-end' STRING_TYPE='layout' RESERVE_SPACE='false'>
<div class='layout layout-none'>
<div section_index='1' class=' layout-body'>
<div bSimpleLayout='true' class='flex content layout-content-default content-default ' >
<div style='' class='content-item content-field item-1 remove-top-spacing remove-left-spacing remove-bottom-spacing remove-right-spacing label-color dataValueWrite flex flex-row ' STRING_TYPE='field' RESERVE_SPACE='true'><span ><i data-test-id='20200511150809067764740' href='' onclick='pd(event);' data-ctl='Icon' class='cursordefault icons far fa-external-link' name='PortalTiles_D_PortalTiles.PortalTiles(2)_65' title= 'Opens in new browser tab ' alt= 'Opens in new browser tab ' ></i></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
有没有人知道我会针对哪个元素点击按钮,以及你怎么知道要选择哪一个?任何见解将不胜感激。
答: 暂无答案
评论