We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matthew Buckett (Bug 38474): HTML Link Parser doesn't find <frame> tags in a page. It only finds anchor and form tags.
OS: Linux
The text was updated successfully, but these errors were encountered:
Matthew Buckett (migrated from Bugzilla): Created attachment anchormodifier.txt: Adds support for following frame tags to AnchorModifier.java
Index: /home/buckett/workspace/jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java =================================================================== --- /home/buckett/workspace/jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java (revision 372904) +++ /home/buckett/workspace/jmeter/src/protocol/http/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java (working copy) @@ -99,6 +99,7 @@ } addAnchorUrls(html, result, sampler, potentialLinks); addFormUrls(html, result, sampler, potentialLinks); + addFramesetUrls(html, result, sampler, potentialLinks); if (potentialLinks.size() > 0) { HTTPSamplerBase url = (HTTPSamplerBase) potentialLinks.get(rand.nextInt(potentialLinks.size())); sampler.setDomain(url.getDomain()); @@ -196,6 +197,39 @@ } } } + + private void addFramesetUrls(Document html, HTTPSampleResult result, + HTTPSamplerBase config, List potentialLinks) { + String base = ""; + NodeList baseList = html.getElementsByTagName("base"); + if (baseList.getLength() > 0) { + base = baseList.item(0).getAttributes().getNamedItem("href") + .getNodeValue(); + } + NodeList nodeList = html.getElementsByTagName("frame"); + for (int i = 0; i < nodeList.getLength(); i++) { + Node tempNode = nodeList.item(i); + NamedNodeMap nnm = tempNode.getAttributes(); + Node namedItem = nnm.getNamedItem("src"); + if (namedItem == null) { + continue; + } + String hrefStr = namedItem.getNodeValue(); + try { + HTTPSamplerBase newUrl = HtmlParsingUtils.createUrlFromAnchor( + hrefStr, new URL(result.getURL(), base)); + newUrl.setMethod(HTTPSamplerBase.GET); + log.debug("possible match: " + newUrl); + if (HtmlParsingUtils.isAnchorMatched(newUrl, config)) { + log.debug("Is a match! " + newUrl); + potentialLinks.add(newUrl); + } + } catch (MalformedURLException e) { + } catch (org.apache.oro.text.regex.MalformedPatternException e) { + log.error("Bad pattern", e); + } + } + } public static class Test extends JMeterTestCase { public Test(String name) {
Sorry, something went wrong.
Sebb (migrated from Bugzilla): Thanks for the patch; it has been applied to the 2.1 branch and will appear in the next release of JMeter
No branches or pull requests
Matthew Buckett (Bug 38474):
HTML Link Parser doesn't find <frame> tags in a page. It only finds anchor and
form tags.
OS: Linux
The text was updated successfully, but these errors were encountered: