Jun-10-2019, 07:19 PM
HI All,
I' mlearning python and writing few programs to automate my testing. I am trying to do url validation based on what user has entered.If user inputs the version as 21.1.0 then I should be able to search for 21.1.10 in the base_url and if match found then only open the link. I'm struggling to find the match with the version user enters.
If I enter 1.1.0 it scans the website for 1.1.0 and if there's 21.1.0, it finds the match and prints vresion found. I want if it matches only with 21.1.0 then only open the link or if user enters 2.2.0 and there's 2.2.0 then I should find the match for 2.2.0 and not for 12.2.0.
Please note this is not the correct base_url.
I' mlearning python and writing few programs to automate my testing. I am trying to do url validation based on what user has entered.If user inputs the version as 21.1.0 then I should be able to search for 21.1.10 in the base_url and if match found then only open the link. I'm struggling to find the match with the version user enters.
If I enter 1.1.0 it scans the website for 1.1.0 and if there's 21.1.0, it finds the match and prints vresion found. I want if it matches only with 21.1.0 then only open the link or if user enters 2.2.0 and there's 2.2.0 then I should find the match for 2.2.0 and not for 12.2.0.
Please note this is not the correct base_url.
import urllib2
import re
base_url = "http://artifactory.int.abc.com:9090/artifactory/simple/test-local/com/abc/test/test.far/"
user_input = raw_input("Enter the test version you want to upgrade to: ")
#connect to a URL
website = urllib2.urlopen(base_url)
#read html code
html = website.read()
print(html)
test2 = re.search(user_input, html)
if user_input in html:
print("version found")
else:
print("version not found")
