I need the sibling of a previously selected element(s).
For example:
<div class="dt">Technology</div>
<div class="da">GSM / CDMA / HSPA / EVDO / LTE</div>
<div class="dt">Dimensions</div>
<div class="da">149.9 x 70.4 x 7.8 mm (5.90 x 2.77 x 0.31 in)</div>
<div class="dt">Weight</div>
<div class="da">157 g (5.54 oz)</div>
<div class="dt">Build</div>
<div class="da">Back glass (Gorilla Glass 5), aluminum frame </div>
<div class="dt">Type</div>
<div class="da">Dynamic AMOLED capacitive touchscreen, 16M colors</div>
<div class="dt">SIM</div>
<div class="da">Single SIM (Nano-SIM) or Hybrid Dual SIM)</div>
Let say I need the "Dimensions" and Type.
code:
dts = browser.find_elements_by_class_name("dt");
for dt in dts :
if dt.("innerText") == "Dimensions":
print(dt.("innerText") + "-" + dt.**FollowingSibling**())
if dt.("innerText") == "Type":
print(dt.("innerText") + "-" + dt.**FollowingSibling**())
expected output:
Dimensions - 149.9 x 70.4 x 7.8 mm (5.90 x 2.77 x 0.31 in)
Type - Dynamic AMOLED capacitive touchscreen, 16M colors