Click here to Skip to main content
15,887,337 members
Home / Discussions / Java
   

Java

 
GeneralRe: Code to Read Raw data from Wireless Modem in java Pin
Member 1409909026-Dec-18 0:48
Member 1409909026-Dec-18 0:48 
GeneralRe: Code to Read Raw data from Wireless Modem in java Pin
Richard MacCutchan26-Dec-18 2:10
mveRichard MacCutchan26-Dec-18 2:10 
AnswerRe: Code to Read Raw data from Wireless Modem in java Pin
jschell27-Dec-18 13:27
jschell27-Dec-18 13:27 
QuestionJava Panel Program Pin
Member 1408268117-Dec-18 11:36
Member 1408268117-Dec-18 11:36 
AnswerRe: Java Panel Program Pin
Richard MacCutchan17-Dec-18 22:33
mveRichard MacCutchan17-Dec-18 22:33 
Questionjava program cannot compile Pin
Member 1409285317-Dec-18 9:55
Member 1409285317-Dec-18 9:55 
AnswerRe: java program cannot compile Pin
Richard MacCutchan17-Dec-18 22:23
mveRichard MacCutchan17-Dec-18 22:23 
QuestionConnecting to website and checking elements Pin
Valentinor15-Dec-18 1:57
Valentinor15-Dec-18 1:57 
Hi,

How can I connect to a website, and check if there are any elements that contain an given id, class or name. As for an example, let's say connect to https://www.google.com/, and check if this website has an element (input, div, image, etc) with id="anElement", or class="anElement", or name="anElement".
I have tried using the following code, but I'm getting from one error to another, which makes me think this isn't what I have to use, or I'm just doing it wrong.

URL url = new URL("https://www.google.com/");
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new InputSource(httpURLConnection.getInputStream()));
NodeList noteList = doc.getElementsByTagName("anElement");

AnswerRe: Connecting to website and checking elements Pin
Richard MacCutchan15-Dec-18 3:49
mveRichard MacCutchan15-Dec-18 3:49 
GeneralRe: Connecting to website and checking elements Pin
Valentinor15-Dec-18 4:19
Valentinor15-Dec-18 4:19 
GeneralRe: Connecting to website and checking elements Pin
Richard MacCutchan15-Dec-18 4:40
mveRichard MacCutchan15-Dec-18 4:40 
GeneralRe: Connecting to website and checking elements Pin
Valentinor15-Dec-18 4:54
Valentinor15-Dec-18 4:54 
GeneralRe: Connecting to website and checking elements Pin
Richard MacCutchan15-Dec-18 5:01
mveRichard MacCutchan15-Dec-18 5:01 
GeneralRe: Connecting to website and checking elements Pin
Valentinor15-Dec-18 5:54
Valentinor15-Dec-18 5:54 
GeneralRe: Connecting to website and checking elements Pin
jschell15-Dec-18 7:05
jschell15-Dec-18 7:05 
AnswerRe: Connecting to website and checking elements Pin
jschell15-Dec-18 7:07
jschell15-Dec-18 7:07 
GeneralRe: Connecting to website and checking elements Pin
Valentinor15-Dec-18 9:30
Valentinor15-Dec-18 9:30 
QuestionHandle Multiple Threads With One Server Pin
Member 1408670212-Dec-18 0:45
Member 1408670212-Dec-18 0:45 
AnswerRe: Handle Multiple Threads With One Server Pin
Richard MacCutchan12-Dec-18 21:54
mveRichard MacCutchan12-Dec-18 21:54 
AnswerRe: Handle Multiple Threads With One Server Pin
jschell15-Dec-18 7:12
jschell15-Dec-18 7:12 
QuestionMerge sort question Pin
Member 1408406810-Dec-18 5:31
Member 1408406810-Dec-18 5:31 
AnswerRe: Merge sort question Pin
Richard MacCutchan10-Dec-18 6:32
mveRichard MacCutchan10-Dec-18 6:32 
GeneralRe: Merge sort question Pin
Member 1408406810-Dec-18 11:37
Member 1408406810-Dec-18 11:37 
GeneralRe: Merge sort question Pin
Richard MacCutchan10-Dec-18 21:50
mveRichard MacCutchan10-Dec-18 21:50 
GeneralRe: Merge sort question Pin
Member 1408406811-Dec-18 0:30
Member 1408406811-Dec-18 0:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.