0

I am testing a football betting website currently. In this website there is a different game every day. So each game has a different id in the URL. An example of this would be https://web-game-stage.sportgames.com/games/5b310f8967ef5ad461d75aef/ so the 5b310f8967ef5ad461d75aef is the game id. How can i extract this code from the URL and basically just make it a string??

3
  • How do you get to this url. Is it some href? Commented Jun 28, 2018 at 9:26
  • On the main page each game has a different name so i just select the name to go to the game page Commented Jun 28, 2018 at 9:28
  • Can you provide the html behind that game element? What kind of element is that and what all attributes are there? Commented Jun 28, 2018 at 9:33

1 Answer 1

1

after going to the game page. You get extract game id as given below.

String currentURL = driver.getCurrentUrl();
String[] arrayURL = currentURL.split('/');
int arrLength = arrayURL.length;
String gameID = arrayURL[arrLength-1];
System.out.println("game ID = "+gameID);
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.