用户输入Y后,Do-while循环仅执行两次

时间:2020-10-27 10:25:05

标签: java user-input do-while

我的程序中的do while语句出现问题。我希望它在用户输入Y时重复该方法,然后在用户输入N并退出并返回菜单时退出。

在第二次用户输入之后,程序不再读取Y / N,也不再执行该语句。如果能在此方面获得帮助,我将不胜感激!

 def test01_check_urls(self, test_setup):
        #reading the file
        Total_entries=len(old_urls)            //Total_entries=5
        print("Total entries in the sheet: "+ str(Total_entries))
        col_count=0

        #opening urls
        while col_count<Total_entries:
            Webpage=old_urls[col_count]          //fetching data from 1st cell in the excel
            Newpage=new_urls[col_count]          //fetching data from 1st cell in the excel
            driver.get(Webpage)
            print("The old page url is: "+Webpage)
            page_title=driver.title
            print(page_title)
            Redr_page=driver.current_url
            print("The new url is: "+Redr_page)
            print("New_url from sheet:"+Newpage)

            try:
                if Redr_page==Newpage:
                    print("Correct url")
            except:
                raise Exception("Url mismatch")

            col_count+=1

0 个答案:

没有答案