0

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.

8
  • can you share a link to the page you are working on and more your code? Commented Mar 6, 2022 at 12:38
  • I can't, because you need to be citizen of my country and you need to login with my country's authentication methods Commented Mar 6, 2022 at 12:39
  • I understand. What exactly error is presented? Commented Mar 6, 2022 at 12:41
  • There is no error in terminal, code just skip the part of code which i did put in question and try to complete next codeline. Commented Mar 6, 2022 at 12:43
  • 1
    Okay, i found the problem serijachh must be in '' not in ""! Commented Mar 6, 2022 at 14:04

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.