【发布时间】:2021-11-23 12:12:19
【问题描述】:
所以我有以下 HTML:
<div data-baseweb="popover" id="bui4" class="fc ap ao gc if ig ih ii ij ik iz g2 j0 j1 io">
<div class="gc if ig ih ii cj b5">
<div class="ip iq b6 ag b8">
<div class="ag b8 hu ae">
<div class="j5 ag am ai">
<button data-baseweb="button" class="bm bn ai bo bp bq br bs bt bu bv bw bx by b1 bz c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca ax ay az b0 ig ih if ii cf cg ch ci cj it j6 iv j7">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" color="#000000">
<title>Arrow left</title>
<path d="M22 13.5H6.3l5.5 7.5H8.3l-6.5-9 6.5-9h3.5l-5.5 7.5H22v3z" fill="currentColor"></path>
</svg>
</button>
<div class="ax ay az b0">Stores</div>
<div class="j2 j3"></div>
</div>
<div class="ag b8 f3 f5">
<div data-baseweb="input" class="ar ag cn af ft fu fv fw fx fy fz g0 g1 c1 g2 if ii ig ih ax h6 g3 h7 g5 g6 g7 g8 gc gh g9 j8">
<div class="ag ai bo gn c1 g2 ax h6 g3 h7 j9 is cj gc">
<svg data-baseweb="icon" title="Search" viewBox="0 0 24 24" class="ja jb jc jd je">
<title>Search</title>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 6C8.79086 6 7 7.79086 7 10C7 12.2091 8.79086 14 11 14C13.2091 14 15 12.2091 15 10C15 7.79086 13.2091 6 11 6ZM5 10C5 6.68629 7.68629 4 11 4C14.3137 4 17 6.68629 17 10C17 11.2958 16.5892 12.4957 15.8907 13.4765L19.7071 17.2929C20.0976 17.6834 20.0976 18.3166 19.7071 18.7071C19.3166 19.0976 18.6834 19.0976 18.2929 18.7071L14.4765 14.8907C13.4957 15.5892 12.2958 16 11 16C7.68629 16 5 13.3137 5 10Z"></path>
</svg>
</div>
<div data-baseweb="base-input" class="ag af gb c1 g2 ax h6 g3 h7 cj gc"><input aria-invalid="false" aria-required="false" autocomplete="on" inputmode="text" name="" placeholder="Search" type="text" class="ar it bp br bq bs bt bv bu bw bx af gd ge gf be jf jg gh g9 ax ay g3 g4 cj gi gj" value=""></div>
</div>
<div class="ag cu"><button data-baseweb="button" class="bm bn ai bo bp bq br bs bt bu bv bw bx by b1 bz c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca ax ay az b0 cb cc cd ce cf cg ch ci fq ck cl cm jh">Select all</button><button data-baseweb="button" disabled="" class="bm bn ai bo bp bq br bs bt bu bv bw bx by b1 bz c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca ax ay az b0 cb cc cd ce cf cg ch ci jh">Clear</button></div>
</div>
<div class="ae j4 hi" style="position: relative;">
<div style="overflow: visible; height: 0px; width: 0px;">
<div aria-label="grid" aria-readonly="true" class="ReactVirtualized__Grid ReactVirtualized__List" role="grid" tabindex="0" style="box-sizing: border-box; direction: ltr; height: 172px; position: relative; width: 375px; will-change: transform; overflow: auto; outline: none;">
<div class="ReactVirtualized__Grid__innerScrollContainer" role="rowgroup" style="width: auto; height: 33616px; max-width: 375px; max-height: 33616px; overflow: hidden; position: relative;">
<div style="height: 44px; left: 0px; position: absolute; top: 0px; width: 100%;">
<label data-baseweb="checkbox" class="bn ag ai c3 jj f3">
<span class="jk c1 g2 jl j2 j3 jm jn ar fx fy fz g0 jo jp jq jr js jt ju jv if ig ih ii bx ja jw ah jx jy jz k0 k1 hl k2"></span><input aria-checked="false" type="checkbox" class="im k3 k4 cn be bf fc" value="">
<div class="jw is cj ax h6 az h7 af k5 ag am ai k6 k7 k8">
<div>
<div class="ax ay az b0 co cq cn ji">Store 0</div>
<div class="ax ay g3 g4 h8 co cq cn ji">Sample Address</div>
</div>
</div>
</label>
</div>
<div style="height: 44px; left: 0px; position: absolute; top: 44px; width: 100%;">
<label data-baseweb="checkbox" class="bn ag ai c3 jj f3">
<span class="jk c1 g2 jl j2 j3 jm jn ar fx fy fz g0 jo jp jq jr js jt ju jv if ig ih ii bx ja jw ah jx jy jz k0 k1 hl k2"></span><input aria-checked="false" type="checkbox" class="im k3 k4 cn be bf fc" value="">
<div class="jw is cj ax h6 az h7 af k5 ag am ai k6 k7 k8">
<div>
<div class="ax ay az b0 co cq cn ji">Store 1</div>
<div class="ax ay g3 g4 h8 co cq cn ji">Sample Address</div>
</div>
</div>
</label>
</div>
<div style="height: 44px; left: 0px; position: absolute; top: 88px; width: 100%;">
<label data-baseweb="checkbox" class="bn ag ai c3 jj f3">
<span class="jk c1 g2 jl j2 j3 jm jn ar fx fy fz g0 jo jp jq jr js jt ju jv if ig ih ii bx ja jw ah jx jy jz k0 k1 hl k2"></span><input aria-checked="false" type="checkbox" class="im k3 k4 cn be bf fc" value="">
<div class="jw is cj ax h6 az h7 af k5 ag am ai k6 k7 k8">
<div>
<div class="ax ay az b0 co cq cn ji">Store 2</div>
<div class="ax ay g3 g4 h8 co cq cn ji">Sample Address</div>
</div>
</div>
</label>
</div>
<div style="height: 44px; left: 0px; position: absolute; top: 132px; width: 100%;">
<label data-baseweb="checkbox" class="bn ag ai c3 jj f3">
<span class="jk c1 g2 jl j2 j3 jm jn ar fx fy fz g0 jo jp jq jr js jt ju jv if ig ih ii bx ja jw ah jx jy jz k0 k1 hl k2"></span><input aria-checked="false" type="checkbox" class="im k3 k4 cn be bf fc" value="">
<div class="jw is cj ax h6 az h7 af k5 ag am ai k6 k7 k8">
<div>
<div class="ax ay az b0 co cq cn ji">Store 3</div>
<div class="ax ay g3 g4 h8 co cq cn ji">Sample Address</div>
</div>
</div>
</label>
</div>
<div style="height: 44px; left: 0px; position: absolute; top: 176px; width: 100%;">
<label data-baseweb="checkbox" class="bn ag ai c3 jj f3">
<span class="jk c1 g2 jl j2 j3 jm jn ar fx fy fz g0 jo jp jq jr js jt ju jv if ig ih ii bx ja jw ah jx jy jz k0 k1 hl k2"></span><input aria-checked="false" type="checkbox" class="im k3 k4 cn be bf fc" value="">
<div class="jw is cj ax h6 az h7 af k5 ag am ai k6 k7 k8">
<div>
<div class="ax ay az b0 co cq cn ji">Store 4</div>
<div class="ax ay g3 g4 h8 co cq cn ji">Sample Address</div>
</div>
</div>
</label>
</div>
</div>
</div>
</div>
<div class="resize-triggers">
<div class="expand-trigger">
<div style="width: 376px; height: 173px;"></div>
</div>
<div class="contract-trigger"></div>
</div>
</div>
</div>
<div class="ic"><button data-baseweb="button" disabled="" class="bm bn ai bo bp bq br bs bt bu bv bw bx by b1 bz c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 ca ax ay az b0 ig ih if ii cf cg ch ci af">Apply</button></div>
</div>
</div>
</div>
这是一个动态下拉菜单,所以如果我向下滚动更多,ReactVirtualized__Grid__innerScrollContainer 下的div 会显示更多。
这将是我需要的步骤:
1:打开下拉菜单,选中第一个复选框,获取商店名称和地址,点击应用按钮...
2:打开下拉菜单,选择第二个复选框,获取商店名称和地址,点击应用按钮...
3:打开下拉菜单,选中第三个复选框,获取店铺名称和地址,点击APPLY按钮...
.
.
.
Last n:打开下拉菜单,选中第 n 个复选框,获取商店名称和地址,点击 APPLY 按钮...
但是按照这个步骤,下拉里面的动态滚动是必须要考虑的。
另外,我只想提一下,当点击页面的页面源时,我看不到上面的 HTML。只有打开开发工具才能看到。
【问题讨论】:
标签: python-3.x selenium