How to create a loop that checks if "Remove" exists for multiple "Remove" [Helium] [Selenium] [Python]
<p>How to loop the below logic inside a script, till all are deleted then continue to the next text. </p>

<pre><code>if Text("Remove").exists():
click("Remove")
</code></pre>

<p>Explaination:</p>

<p>==============</p>

<p>WEBPAGE 1
CONTENTS:</p>

<p>â
A (REMOVE)
â
B (REMOVE)
â
C (REMOVE)</p>

<p>[ âRemoveâ is a clickable link that removes A, B ,C]</p>

<p>==============</p>

<p>Part of my script now:</p>

<p>if Text(âRemoveâ).exists():
    click(âRemoveâ)
    click(âOKâ)</p>

<p>===============</p>

<p>Result:</p>

<p>WEBPAGE 1
CONTENTS:</p>

<p>â</p>

<p>â
B (REMOVE)
â
C (REMOVE)</p>

<p>================</p>

<p>Above A is removed by the script.
My question is how can i loop that, so the result is:</p>

<p>===============</p>

<p>Result:</p>

<p>WEBPAGE 1
CONTENTS:</p>

<p>â</p>

<p>â</p>

<p>â</p>

<p>================</p>

<p>So for every text on the webpage that containts âRemoveâ
It executes the script untill there is no âRemoveâ anymore.</p>

<p>Since Your mind is orbiting around .remove() :</p>

<pre><code>a = 'This is just a Test'
a_list = []

for i in range(0, len(a) - 1):
    a_list.append(a[i])

while 't' in a_list: a_list.remove('t') # This Removes all lower case "t"s in a_list   

a = ''

# Then you can change it into a string again :
for n in range(0, len(a_list) - 1):
    a += a_list[n]

print(a) # This is the original 'a' only without lower case "t"s
</code></pre>

<p>But this is <strong>NOT</strong> a good way to do (it's kinda ridicules) i recommend :</p>

<p>.replace(,) </p>

<p>which is already explained</p>

python selenium helium