I use Playwright FOR JAVA to test the WEB TIKTOK LIVE PAGE ,
which will result in the absence of barrage on the WEB TIKTOK LIVE PAGE , Even if I log in to my TikTok account , the page only prompts me for my account to enter the live broadcast room
It seems that the automated testing software has been detected,My code has simulated UserAgent
I would like to know the solution for this,Thank you.
try (Playwright playwright = Playwright.create()) {
Path userDataDir = Paths.get("C:\\Users\\wu\\AppData\\Local\\Google\\Chrome\\User Data\\playwright");
BrowserContext browserContext = playwright.chromium().launchPersistentContext(userDataDir,
new BrowserType.LaunchPersistentContextOptions()
.setHeadless(false)
.setSlowMo(500)
.setUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36")
);
Page page = null;
List<Page> pages = browserContext.pages();
if(pages!=null && pages.size()>0){
page = pages.get(0);
}
if(page==null){
System.out.println("page is null");
return;
}
while (true) {
try {
if(pageOut!=null){
pageOut.content();
}
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Top comments (0)