newcoder1010 Posted September 23, 2020 Share Posted September 23, 2020 Hello, HTML source code: https://www.walmart.com/ip/Parent-s-Choice-Diapers-Size-3-36-Diapers/14912811 If you view html source code, you will see the upc code. "standardusItemId":"401199665","upc":"681131167444","fetched":true, I like to write a program to just print the code(value only). String str = driver.getPageSource(); System.out.println("-----"); System.out.println(str); System.out.println("field" + str.indexOf("upc")); System.out.println("value" + str.indexOf("681131167444")); Result: index1033185 upc603459 I know code is not complete. My code gets the page source just fine. Only extracting the code is not working. Please advise! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now