用户输入Y后,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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)