Reputation: 33
so i need app to click on correct button, when there is an option, now other option is not present, there is one value that i found out will change. there is website code:
<form name="uniforma_NE" id="uniforma_NE" .="" method="POST">
<input type="hidden" name="nrSeries" id="nrSeries" value="NE">
<input type="hidden" name="seriesType" id="seriesType" value="2">
<input class="button" name="chooseNrSeries" id="chooseNrSeries" type="submit" value="choose">
The value that will be present with the first one when there will be other option
<form name="uniforma_NH" id="uniforma_NH" .="" method="POST">
<input type="hidden" name="nrSeries" id="nrSeries" value="NH">
<input type="hidden" name="seriesType" id="seriesType" value="2">
<input class="button" name="chooseNrSeries" id="chooseNrSeries" type="submit" value="choose">
so my part of code is here:
serijach = input("")
serijachh = "uniforma_" + serijach
confirm = driver.find_element_by_name("confirm").click()
#3 lapa
sesr = driver.find_element_by_id(serijachh).click()
#4 lapa
yyy2 = driver.find_element_by_name("name")
yyy2.send_keys(mnr2)
mekletPoga = driver.find_element_by_name("name2").click()
It skips the sesr =, and goes on to try complete the yyy2
I don't know how and why it was working yesterday, but today it's not and i can't afford to make mistake when it will be done. In terminal it shows that everything was fine and script couldn't find the next step which was not present because it didn't go through this one.
Upvotes: 0
Views: 321
Reputation: 33
So I found out three solutions for this problem.
First one is to put serijachh
in '' like that
serijach = input("")
serijachh = 'uniforma_' + serijach
confirm = driver.find_element_by_name("confirm").click()
#3 lapa
sesr = driver.find_element_by_id(serijachh).click()
#4 lapa
yyy2 = driver.find_element_by_name("name")
yyy2.send_keys(mnr2)
mekletPoga = driver.find_element_by_name("name2").click()
And 2nd is to change id
to name
, because they share same name
as id
serijach = input("")
serijachh = "uniforma_" + serijach
confirm = driver.find_element_by_name("confirm").click()
#3 lapa
sesr = driver.find_element_by_name(serijachh).click()
#4 lapa
yyy2 = driver.find_element_by_name("name")
yyy2.send_keys(mnr2)
mekletPoga = driver.find_element_by_name("name2").click()
Found 3rd solution, you need to have F12 console opened if neither of fixes helps
Upvotes: 1