0
The webview will not be visible, so the goal is to automatically open the first video of the search. I believe it is not too complicated in JS.
code:
public class FXMLDocumentController implements Initializable {
@FXML
private WebView tela;
@FXML
private Button botão;
WebEngine webengine;
@Override
public void initialize(URL url, ResourceBundle rb) {
webengine = tela.getEngine();
webengine.load("https://www.youtube.com/results?search_query=exemplo");
}
This function returns the link: Document.getElementsByClassName('yt-simple-endpoint style-Scope ytd-video-Renderer')[0]. getattribute('href'). But for some reason it gives error when running inside Javafx. getElementById only takes if it is only 1 element.
– Gustavo Fragoso
From what I researched, the most practical would be to use a code in JS
– Evandro Casanova