Home > Enterprise >  Java Selenium JavascriptExecutor
Java Selenium JavascriptExecutor

Time:11-10

There is that one russian gambling website, and i want to get information from it for example in String. Here is my code:

 import org.openqa.selenium.JavascriptExecutor;
    import org.openqa.selenium.WebDriver;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import org.openqa.selenium.firefox.FirefoxOptions;
    import java.util.concurrent.TimeUnit;
    
    public class Main {
        public static void main(String[] args){
            FirefoxOptions options = new FirefoxOptions();
            String userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36 OPR/60.0.3255.170";
            System.setProperty("webdriver.gecko.driver","C:\\Users\\dbondarenko\\IdeaProjects\\geckodriver.exe");
        WebDriver driver = new FirefoxDriver();
        JavascriptExecutor js = (JavascriptExecutor)driver;

        String baseUrl = "https://parimatch.com/ru/events/romania-iceland-6764586";

        driver.get(baseUrl);

        driver.manage().window().maximize();

        driver.manage().timeouts().setScriptTimeout(20, TimeUnit.SECONDS);

        String DomainName = js.executeScript("return document.domain;").toString();
        System.out.println("Domain name of the site = "   DomainName);

        String url = js.executeScript("return document.URL;").toString();
        System.out.println("URL of the site = "   url);

        String TitleName = js.executeScript("return document.title;").toString();
        System.out.println("Title of the page = "   TitleName);

        String innerText = js.executeScript(" return document.documentElement.innerText;").toString();
        System.out.println("Inner text of the page = "   innerText);

        js.executeScript("window.location = 'http://parimatch.com'");
    }
}

Some of the output is right, but i don't get the exact output that i need. Instead i am getting a lot of ... signs. I've tried multiple solutions but now i am clueless. How can i overcome this? Page URL you can get from the code. And here is my output:

Domain name of the site = parimatch.com
URL of the site = https://parimatch.com/ru/events/romania-iceland-6764586
Title of the page = Ставки на - . . . . - в БК Parimatch
JavaScript warning: https://parimatch.com/fpapi/s.js, line 1: WEBGL_debug_renderer_info is deprecated in Firefox and will be removed. Please use RENDERER.
JavaScript warning: https://parimatch.com/fpapi/s.js, line 1: WEBGL_debug_renderer_info is deprecated in Firefox and will be removed. Please use RENDERER.
JavaScript warning: https://promo.parimatch.com/api/adpool/static/adp.js, line 113: WEBGL_debug_renderer_info is deprecated in Firefox and will be removed. Please use RENDERER.
Inner text of the page = ...
...
...
...
...
...
...
Топ
Топ Экспрессы (and so on)

CodePudding user response:

When you use document.documentElement.innerText


Solution

If you induce some waits and then execute the relevant lines of code, as an example Thread.sleep(5000), you will find the following output:

Live Events
Upcoming Matches
Virtuals
Slots
Live Casino
Greyhounds and Horse Racing
TV Games
Instant Games
EN
Log in
Sign up
Top
Top Parlays
LIVE
Cricket
LIVE
Football
LIVE
Esports
LIVE
Tennis
LIVE
Table Tennis
LIVE
Basketball
LIVE
Volleyball
LIVE
Ice Hockey
UFC
American football
Bandy
LIVE
Beach Volleyball
Boxing
Futsal
Handball
Motor Sports
Rugby
Water Polo
TOP CHAMPIONSHIPS
Cricket
National teams. Twenty20. ICC World Cup
Football
National teams. FIFA World Cup. European Qualification
National teams. FIFA World Cup. South American Qualification
UEFA Champions League. Group stage
UEFA Europa League. Group stage
UEFA Europa Conference League. Group stage
England. Premier League
Germany. Bundesliga
Spain. LaLiga
Italy. Serie A
France. Ligue 1
Tennis
ATP. Stockholm. Hard
WTA. Linz. Hard
ATP. Milan. Hard (Best of 5 sets. Set to win 4 games)
Table Tennis
Russia. Men. Liga Pro
Basketball
NBA. Regular Season
Euroleague. Regular Season
Cyberbasketball. NBA (format 4x8 mins, OT-4 mins)
China. CBA
UFC
Event. Fight Night (13/11/2021)
Event. Fight Night (21/11/2021)
Event. Fight Night (05/12/2021)
SPORTS WELCOME BONUS
Get 150% up to12000 on your First Deposit
EXCLUSIVE DIWALI WELCOME BONUS  150%
PARIMATCH is here to make your DIWALI 150% brighter.
GREYHOUNDS AND HORSE RACING
Join challenges of lords on Parimatch
ICC MEN'S T20 WORLD CUP
Don't hesitate and place your bets to win!
NBA IS COMING BACK!
Check odds and make a bet on your favorite teams!
INDIAN JACKPOT
Hurry up to participate and WIN ₹33,04,265!
FANTASY SPORT
Win real money with Parimatch
FIRST BET INSURANCE
Get 100% your bet up to3000 if your first bet doesn't win
ENGLISH PREMIER LEAGUE 2021/22
Bet on your favorite team now and win
SPORTS WELCOME BONUS
Get 150% up to12000 on your First Deposit
EXCLUSIVE DIWALI WELCOME BONUS  150%
PARIMATCH is here to make your DIWALI 150% brighter.
GREYHOUNDS AND HORSE RACING
Join challenges of lords on Parimatch
ICC MEN'S T20 WORLD CUP
Don't hesitate and place your bets to win!
NBA IS COMING BACK!
Check odds and make a bet on your favorite teams!
INDIAN JACKPOT
Hurry up to participate and WIN ₹33,04,265!
FANTASY SPORT
Win real money with Parimatch
FIRST BET INSURANCE
Get 100% your bet up to3000 if your first bet doesn't win
ENGLISH PREMIER LEAGUE 2021/22
Bet on your favorite team now and win
SPORTS WELCOME BONUS
Get 150% up to12000 on your First Deposit
EXCLUSIVE DIWALI WELCOME BONUS  150%
PARIMATCH is here to make your DIWALI 150% brighter.
GREYHOUNDS AND HORSE RACING
Join challenges of lords on Parimatch
ICC MEN'S T20 WORLD CUP
Don't hesitate and place your bets to win!
NBA IS COMING BACK!
Check odds and make a bet on your favorite teams!
INDIAN JACKPOT
Hurry up to participate and WIN ₹33,04,265!
FANTASY SPORT
Win real money with Parimatch
FIRST BET INSURANCE
Get 100% your bet up to3000 if your first bet doesn't win
ENGLISH PREMIER LEAGUE 2021/22
Bet on your favorite team now and win
LIVE! Cricket. World Cup
Live Casino
Roulette
Greyhounds and Horse Racing
Baccarat
Cricket.
LIVE! Table Tennis
Blackjack
JetX
Virtual Cricket
Indian choice
Casino Slots
Promo
JACKPOT 3.527.953 INR
TV Games
Instant Games
Cricket
National teams. Twenty20. ICC World Cup
Innings 1
India
Namibia
0
96
More
National teams. Twenty20. ICC World Cup. Qualifier
Innings 1
Argentina
Bahamas
41
121
1
1.02
2
11.00
National teams. Twenty20. ICC World Cup. Qualifier
Innings 1
Belize
Canada
13
234
More
Clubs. European Series T10
Montcada Royal
08 Nov
21:30
Punjab Warriors
1
1.29
2
3.30
National teams. Twenty20. ICC World Cup. Qualifier
Belize
08 Nov
23:00
Panama
1
2.80
2
1.38
Clubs. European Series T10
Hawks CC
09 Nov
00:00
Montcada Royal
1
2.00
2
1.72
India. Syed Mushtaq Ali Trophy
Andhra
09 Nov
07:30
Himachal Pradesh
1
1.67
2
2.21
Australia. Women. Twenty20. Big Bash League
Sydney Sixers (w)
09 Nov
09:05
Brisbane Heat (w)
1
1.86
2
1.88
India. Syed Mushtaq Ali Trophy
Haryana
09 Nov
12:00
Rajasthan
1
2.17
2
1.70
Australia. Women. Twenty20. Big Bash League
Adelaide Strikers (w)
09 Nov
12:30
Sydney Thunder (w)
1
1.63
2
2.24
Football
National teams. FIFA World Cup. European Qualification
Russia
11 Nov
22:30
Cyprus
1
1.16
X
7.00
2
21.00
National teams. FIFA World Cup. European Qualification
Germany
12 Nov
01:15
Liechtenstein
1
1.01
X
25.00
2
51.00
National teams. FIFA World Cup. European Qualification
Malta
12 Nov
01:15
Croatia
1
22.00
X
8.30
2
1.13
National teams. FIFA World Cup. European Qualification
Greece
12 Nov
01:15
Spain
1
8.10
X
4.10
2
1.45
National teams. FIFA World Cup. European Qualification
Georgia
11 Nov
22:30
Sweden
1
7.60
X
4.00
2
1.49
National teams. FIFA World Cup. European Qualification
Italy
13 Nov
01:15
Switzerland
1
1.62
X
3.85
2
5.60
National teams. FIFA World Cup. European Qualification
Ireland Republic
12 Nov
01:15
Portugal
1
9.80
X
4.90
2
1.35
National teams. FIFA World Cup. European Qualification
Slovakia
12 Nov
01:15
Slovenia
1
2.20
X
3.05
2
3.70
National teams. FIFA World Cup. European Qualification
Denmark
13 Nov
01:15
Faroe Islands
1
1.04
X
15.50
2
40.00
National teams. FIFA World Cup. European Qualification
Croatia
14 Nov
19:30
Russia
1
1.67
X
4.00
2
4.90
Table Tennis
Ukraine. Men. Setka Cup
Set 5
Stukalov Vladislav
Kunchurov Dmitriy
4
8
11
5
5
0
2
2
1
1.09
2
6.10
Ukraine. Men. Setka Cup
Set 5
Mosyuk Nazar
Verbіanyi Vasyl
4
5
11
5
0
1
2
2
1
3.05
2
1.33
Ukraine. Men. Setka Cup
live
Kononikhin Vladimir
Yurenev Oleh
1
1.85
2
1.85
Ukraine. Women. Setka Cup
Set 3
Midvetskaya Anastasiya
Trigub Julia
2
11
7
3
6
5
2
0
1(-9.5)
1.75
2( 9.5)
1.95
Ukraine. Men. Setka Cup
Set 2
Galimbaev Rustam
Sokoltsov Yevgeniy
1
11
8
2
1
3
1
0
1
1.42
2
2.65
Ukraine. Men. Setka Cup
Set 4
Melashenko Aleksandr
Bambutsa Roman
3
11
9
4
1
2
2
1
1
1.50
2
2.40
Ukraine. Men. TT-Cup
Set 5
Kurtenko Andrey
Protopopov Vitaly
4
6
11
5
3
1
2
2
1
1.40
2
2.75
Ukraine. Men. TT-Cup
Set 3
Simonchuk David
Vachta Dmitry
2
11
9
3
6
4
2
0
1
1.07
2
6.75
Challenger Series. Men
Set 2
Bluhm Florian
Muhlbach Carlos
1
6
11
2
9
7
0
1
1
3.60
2
1.25
Russia. Men. Liga Pro
Set 1
Nemashkalo Vladimir
Kolmin Alexander
1
8
7
0
0
1
1.38
2
2.80
Tennis
ATP. Stockholm. Hard
Set 3
Gojowczyk Peter
Kovalik Jozef
P
30
40
3
1
1
1
1
1
1.87
2
1.87
ATP. Stockholm. Hard
Ymer Elias
08 Nov
22:30
Tiafoe Frances
1
4.00
2
1.25
WTA. Linz. Hard
Minnen Greet
08 Nov
22:00
Dodin Oceane
1
1.57
2
2.41
WTA. Linz. Hard
Tan Harmony
08 Nov
21:15
Peterson Rebecca
1
2.48
2
1.53
WTA. Linz. Hard
Set 3
Kozlova Kateryna
Wang Xinyu
P
0
40
3
3
5
1
1
More
ATP. Stockholm. Hard
Istomin Denis
08 Nov
23:30
Krajinovic Filip
1
4.60
2
1.19
ATP Challenger. Roanne. Hard
Giustino Lorenzo
08 Nov
23:05
Gasquet Richard
1
5.00
2
1.15
ATP Challenger. Bratislava 2. Hard
Marterer Maximilian
08 Nov
21:35
Rodionov Jurij
1
1.36
2
3.00
ATP. Doubles. Stockholm. Hard
Set 2
Fritz Taylor/Paul Tommy
Ruusuvuori Emil/Van de Zandschulp Botic
P
30
30
2
3
3
1
0
1
1.27
2
3.50
ATP Challenger. Ortisei. Hard
20:37
Basic Mirza
Karlovskiy Evgeny
1
0
0
0
0
1
1.60
2
2.20
Basketball
NBA. Regular Season
Philadelphia 76ers
09 Nov
05:30
New York Knicks
1
1.69
X
13.00
2
2.55
NBA. Regular Season
Chicago Bulls
09 Nov
06:30
Brooklyn Nets
1
1.96
X
13.00
2
2.11
Europe. Champions League
Dinamo Sassari
09 Nov
01:00
Riesen Ludwigsburg
1
1.94
X
11.00
2
1.98
NBA. Regular Season
Memphis Grizzlies
09 Nov
06:30
Minnesota Timberwolves
1
1.48
X
14.00
2
3.20
Europe. VTB United League
BC Nizhniy Novgorod
08 Nov
21:30
PARMA-PARIMATCH
1
1.82
X
11.00
2
2.11
Europe. Adriatic League 1
KK Cibona
08 Nov
22:30
KRKA
1
1.26
X
14.00
2
3.95
NBA. Regular Season
Denver Nuggets
09 Nov
07:30
Miami Heat
1
2.23
X
13.00
2
1.87
NBA. Regular Season
Dallas Mavericks
09 Nov
07:00
New Orleans Pelicans
1
1.22
X
16.00
2
5.60
Europe. VTB United League
Zenit St.Petersburg
08 Nov
22:30
Zielona Gora
1
1.06
X
26.00
2
8.60
NBA. Regular Season
Los Angeles Lakers
09 Nov
09:00
Charlotte Hornets
1
1.92
X
13.00
2
2.15
Ice Hockey
KHL. Regular season
Spartak Moscow
08 Nov
22:00
Sibir
1
1.94
X
4.20
2
3.35
NHL. Regular season
Washington Capitals
09 Nov
05:30
Buffalo Sabres
1
1.62
X
4.70
2
4.50
NHL. Regular season
New York Rangers
09 Nov
05:30
Florida Panthers
1
2.55
X
4.20
2
2.35
Russia. Parimatch-МHL
2nd period 31'
Sputnik Almetyevsk
Omskie Yastreby
1
4
1
2
0
1
4
2
1
1.13
X
7.50
2
13.00
Russia. Parimatch-VHL
2nd period 30'
Toros
Zauralie
1
0
0
2
1
0
1
0
1
1.44
X
3.90
2
6.80
Russia. Parimatch-VHL
1st period 8'
Izhstal
Chelmet
1
0
0
0
0
1
1.95
X
4.30
2
2.85
NHL. Regular season
Toronto Maple Leafs
09 Nov
06:00
Los Angeles Kings
1
1.67
X
4.50
2
4.30
Russia. Parimatch-МHL
2nd period 32'
Reaktor Nizhnekamsk
Avto
1
0
0
2
0
2
0
2
1
17.00
X
7.50
2
1.10
Kazakhstan. Championship
3rd period 56'
Arlan
Gornyak Rudny
2
2
3
3
0
1
2
6
T
8.5
O
1.90
U
1.85
Denmark. Metal Ligaen
Aalborg Pirates
08 Nov
23:30
Rodovre Mighty Bulls
1
1.20
X
7.00
2
9.40
UFC
Event. Fight Night (13/11/2021)
Roman Dolidze
14 Nov
03:00
Kyle Daukaus
1
2.71
2
1.50
Event. Fight Night (13/11/2021)
Max Holloway
14 Nov
05:30
Yair Rodriguez
1
1.15
2
6.00
Event. Fight Night (13/11/2021)
Marc Diakiese
14 Nov
00:00
Rafael Alves
1
1.59
2
2.45
Event. Fight Night (13/11/2021)
Thiago Henrique Moises
14 Nov
02:10
Joel Alvarez Gonzalez
1
1.43
2
2.97
Event. Fight Night (13/11/2021)
Miguel Baeza
14 Nov
01:30
Kalinn Williams
1
1.71
2
2.21
Event. Fight Night (13/11/2021)
Felicia Spencer
14 Nov
03:30
Leah Letson
1
1.32
2
3.59
Event. Fight Night (13/11/2021)
Cortney Casey
14 Nov
00:30
Liana Jojua
1
1.48
2
2.77
Event. Fight Night (13/11/2021)
Ben Rothwell
14 Nov
04:30
Marcos Rogerio De Lima
1
1.70
2
2.23
Event. Fight Night (13/11/2021)
Song Yadong
14 Nov
02:30
Julio Arce
1
1.75
2
2.15
Event. Fight Night (13/11/2021)
Kennedy Nzechukwu
13 Nov
23:30
Da Un Jung
1
2.07
2
1.81
Parimatch — The Best Online Betting Site in India
Help
Deposit
Withdrawal
Parimatch Mobile App
Live Casino
Authentic Tournaments
Blackjack
Roulette
Poker
Baccarat
Indian Choice
Salon Priva
Other
Slots
Virtual Sports
Sport bets
Cricket Betting
India. Premier League Betting
Live Cricket Betting
Football
Esports
Tennis
Table Tennis
Basketball
Volleyball
Ice Hockey
UFC
Handball
Beach Volleyball
Boxing
MMA
Motor Sport
Baseball
Rugby
Water Polo
Parimatch
Terms & Conditions
Privacy Policy
Public Offer
AML/KYC Policy
Support
Blog
India. Premier League Betting Tips
India. Premier League Live Score
How to watch India. Premier League live
India. Premier League Welcome Bonus
How to Withdraw money
How to bet on Cricket
Betting Odds Guide
How to play Casino
Responsible gambling
Self-exclusion
Dispute resolution
Privacy & Management of Personal Data

Available payment methods

© 1994-2021 Parimatch – Best online betting company. This website is operated by PMSPORT N.V. (reg. number 146906) with a registered address at Schout Bij Nacht Doormanweg 40, Curaçao, This Service operates under the License No.1668/JAZ issued to Curaçao eGaming and Regulated by the Government of Curacao. Payment Agent MYRCIUS INTERNATIONAL LTD (reg. number HE 404130) with a registered address at Christodoulou Hatzipavlou 199, Office 4A, 4th floor, 3936, Limassol, Cyprus
BETSLIP
Your betslip is empty
Click on odds to add a bet to the betslip
Top Parlays
Favorites
Promo
Virtuals
Fantasy Sport
Cricket. T20. ICC World Cup
Greyhounds and Horse Racing
Indian Jackpot
Slots
Live Casino
TV Games
Instant Games
Language
English
हिन्दी
English
বাংলা
తెలుగు
मराठी
தமிழ்
Apps Android/IOS
Licenses
Support
Blog
FAQ
Become an Affiliate
  • Related