Open xuxiaowei-com-cn opened 3 months ago
<dependency>
<groupId>net.sourceforge.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>2.60.0</version>
<scope>test</scope>
</dependency>
package cloud.xuxiaowei.passport.oauth;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.DomNode;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@Slf4j
class AuthorizationCodeTests {
@Test
void start() throws IOException {
try (WebClient webClient = new WebClient();) {
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setUseInsecureSSL(true);
HtmlPage page = webClient.getPage("https://xxw.ac.cn");
DomNode input = page.querySelector("input");
assertNotNull(input);
}
}
}
<dependency>
<groupId>org.htmlunit</groupId>
<artifactId>htmlunit</artifactId>
<version>4.0.0</version>
<scope>test</scope>
</dependency>
package cloud.xuxiaowei.passport.oauth;
import lombok.extern.slf4j.Slf4j;
import org.htmlunit.WebClient;
import org.htmlunit.html.DomNode;
import org.htmlunit.html.HtmlPage;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import static org.junit.jupiter.api.Assertions.assertNotNull;
@Slf4j
class AuthorizationCodeTests {
@Test
void start() throws IOException {
try (WebClient webClient = new WebClient();) {
webClient.getOptions().setJavaScriptEnabled(true);
webClient.getOptions().setUseInsecureSSL(true);
HtmlPage page = webClient.getPage("https://xxw.ac.cn");
DomNode input = page.querySelector("input");
assertNotNull(input);
}
}
}
The project I created using Vue/vite/TS cannot load external JS.