Why is JMeter showing an undefined variable error in the response body even if the web page is working properly if I run it manually? - jmeter

(1/1)
ErrorException
Undefined index: current_institute_id
I am getting above error in jmeter response body but its working fine if i run web page manually . Also i have passed the value of current institute in request.
enter image description here
enter image description here
<div class="container">
<div class="trace trace-as-html">
<table class="trace-details">
<thead class="trace-head"><tr><th>
<h3 class="trace-class">
<span class="text-muted">(1/1)</span>
<span class="exception_title"><abbr title="ErrorException">ErrorException</abbr></span>
</h3>
<p class="break-long-words trace-message">Undefined index: current_institute_id</p>
</th></tr></thead>
<tbody><tr><td><span class="block trace-file-path">in <span title="/var/www/html/mycc/t11/app/Http/Controllers/inquiry/AdmissionFormController.php line 1666"><strong>AdmissionFormController.

As I can see in the Screenshot the information provided is not enough to completely investigate the issue. But I can notice that the data you are sending is not recognized by the server. This means you may be sending data that the server was not expecting.
The solution is to record the script manually after understanding the flow.
Found a video explaining the process. Maybe it'll help you understand the way how you can record manually and not depend on tools that ultimately misguide you.
https://www.youtube.com/watch?time_continue=10&v=Njjz1kzS24E
I'm not sure that'll help with the information provided by you. But it may lead you to a solution

Related

Dispay Laravel blade content to user as is

I have laravel template.blade.php
<div class="classone">
<div class="classtwo">
text
</div>
<div class="classtwo">
text
</div>
</div>
And I would like to display the code to the user as it is. Incluing new line and indents.
I was playing around with {!! !!}, nl2br(view()->render() even Blade::compileString but was unable to find an elegant solution. Everytime I was able to make it work it was difficult to maintain and every small change to the displayed code was laber intense.
I would like to ask for a suggeston how to display more complex html/css/js code to user. I though it will be fairy often topic but was unable to find anything which would help me.
Thank you in advance.
I tried some things out. They may seem a little bit 'hacky' but I think they will suit your purpose. I used a freshly created Laravel 8 application as an example.
<pre>{{ file_get_contents( resource_path('views/welcome.blade.php')) }}</pre>
You can use the Blade facade to compile your blade file to plain php if you want:
<pre>{{ Blade::compileString(file_get_contents( resource_path('views/app.blade.php'))) }}</pre>
I put <pre></pre> tags around the output to show line breaks. It makes the code more readable.

xpath - can not extract user post

I am new to web crawling as well as xpath. However, I am trying to crawl the following website: https://sabobic.blogabet.com/
Basically, I want to extract all "feed_pick_analysis", i.e., all text content which belongs to each post.
I cannot use the statement bellow, because the ID is changing dynamically.
xpath('.//div[#class="feed-pick-title"]/div[#class="col-xs-12 _text-more feed-analysis"]/div[#id="feed_pick_analysis_27759116"]/p').extract()
Thus, I tried to use the following statement:
xpath('.//div[#class="col-xs-12 _text-more feed-analysis"]/div[#contenteditable="false"]/p').extract()
However, I am not even getting any data or tag responded by the website... What is my mistake?
[EDIT] This is the html I am working on:
<div class="col-xs-12 _text-more feed-analysis">
<div contenteditable="false" id="feed_pick_analysis_27759116">
<p>Cant verify asians because nothing is working on this site.<br>
<br>
Game is available in IBC,ISN,SBO<br>
<br>
Game on neutral ground.<br>
<br>
No home advantage for Persipura and thats big minus for them today.<br>
<br>
So Persija will have many fans on the stands, supporting them, so thats more home game for Persija.<br>
<br>
They sign some quality players(Aryanto) and foreigners Xandao and spanish playmaker Tomas who seems to be best player in the league.<br>
<br>
Big value on Persija +0.25 and DNB.<br>
<br>
Fair odds Persija ML #2.10 and dnb #1.50. GL!</p> </div>
<div class="col-xs-12 no-padding margin-top-10">
<small class="last-edit "><em>
last edited: Wed, Sep 11th, 2019, 09:47 </em></small>
</div>
</div>
To make your XPath expression more flexible you can ignore the number in the last #id value. Also note that your expression was missing a space between _text-more and feed-analysis - it has to be _text-more feed-analysis.
.//div[#class="col-xs-12 _text-more feed-analysis"]/div[contains(#id,"feed_pick_analysis")]/p
I merely removed the first div because it was not part of the sample HTML. Add it again, if the expression is not specific enough.

<Spring MVC> Second form on same page causing a lot of errors

A short while ago it was decided that our 'support' tool needed some reforming. This included design and technically. One of these things was making several selections, which were present on any form in the tool, session-scoped.
For this purpose it was decided that we extend our menu-bar with a second form. The form right now is causing a lot of trouble. Namely:
Some pages don't load at all, and instead give a net::ERR_INCOMPLETE_CHUNKED_ENCODING error.
If a page works and I submit the form, the following error occurs: Neither BindingResult nor plain target object for bean name 'command' available as request attribute
Whenever I debug the controller-class, it steps through the code and recognises the bound fields, and assigns them to the linked command-class. Whenever I submit the original form (Not the one from the menu-bar) no errors occur.
This is my form (As it stands now, with testing and all that):
<form:form method="post" action="userbar">
<form:errors path="*" cssClass="error"/>
<span id="headerImageLeft"><img src="<c:url value="/static/images/temp_tc_logo.png"/>" alt="Ticketcounter"/></span>
<li id="menuItemProfile"><spring:message code="button.profile" /></li>
<li id="menuItemChangeList"><spring:message code="button.change-list" /></li></a>
<li id="menuItemLogOff"><spring:message code="button.logout" /></li></a>
<li id="menuItemUsername">
<spring:message code="label.user"/>:
<c:out value="${user.username}"/>
</li>
<c:if test="${not empty clientsList || not empty casesList}">
<li id="menuItemClientBrowser">
Show Archive <form:checkbox path="showArchive" id="showArchive" value="showArchive" onchange="submit();"/>
</li>
</c:if>
</form:form>
The net::ERR_INCOMPLETE_CHUNKED_ENCODING is caused by the part. Whenever I remove that, every page loads normally. Even trying:
<spring:bind path="showArchive">
<input type="checkbox".../>
</spring:bind>
gives the error. Whereas on other .jsp files these tags work a-OK.
The pages are built using a template that picks the menubar.jsp and corresponding page-.jsp files and stitches them together. This way the menu is exactly the same throughout the tool.
I hope someone can help me with this issue, and if I've been vague about some things, or maybe if you possibly want to know more, please ask and I shall answer.
Managed to fix it. The errors seemed to have been an issue regarding the ModelAndView my Controller was returning in the onSubmit() function.
I changed it so that, instead of returning a ModelAndView with a URL ánd a Model, it simply returns a RedirectView. No more errors, except for when I change HTML form-elements to Spring form-elements.

PJAX Scroll Loading

I'm working on a news publishing site that needs to load in stories from an RSS feed below the current news page. I've been using InfiniteAjaxScroll (http://infiniteajaxscroll.com/) to some success however, I've hit a brick wall. There is not way for me to dynamically change what story should load in next as you scroll down the page.
Does anyone know of any other plugins, tutorials, examples that replicate behavior like this. I've searched but come up with nothing that meets these requirements.
I'm trying to create something similar to what the Daily Beast has implemented on their site.
http://www.thedailybeast.com/articles/2014/11/05/inside-the-democrats-godawful-midterm-election-wipeout.html
How do they know what stories to load in?
Thanks!
If you're using the InfiniteAjaxScroll library, the "next story" is whatever link you define as the next URL which can be dynamic for each story you load.
Imagine your first story's HTML as something like this
<div class="stories">
<div class="story">
...
</div>
</div>
<div id="pagination">
next
</div>
Then in the storyC.html you have
...
<div id="pagination">
next
</div>
Assuming you're using some sort of dynamic backend, you would use some sort logic to grab a related story and just set that URL as the "next" URL.

Dynamic display in Grails

I have this problem I'm facing. I have been working on a project using Grails based on the advice from a friend. I'm still a novice in using Grails, so any down to earth explanation would be highly welcomed.
My project is a web application which scans broken or dead links and displays them on a screen. The main application is written in Java, and it displays the output (good links, bad links, pages scanned) continuously on the system console as the scan goes on. I've finished implementing my UI, controllers, views, database using Grails. Now, I will like to display actively in a section of my GSP page say forager.gsp the current link being scanned, the current number of bad links found and the current page being scanned.
The attempts I have tried in implementing this active display include storing the output my application displays on the console in a table in my database. This table has a single row which is constantly updated as the current paged scanned changes, number of good links found changes and number of bad links found changes. As this particular table is being updated constantly, I've written an action in my controller which reads this single line and renders the result to my UI. The problem I'm now facing is that I need a way of constantly updating the result being displayed after an interval of time in my UI. I want the final output to look like
scanning: This page, Bad links: 8, good links: 200
So basically here is my controller action which reads the table from the database
import groovy.sql.Sql
class PHPController {
def index() {}
def dataSource
def ajax = {
def sql = new Sql(dataSource)
def errors = sql.rows("SELECT *from links")
render (view: 'index', template:'test', model:[errors:errors])
}
}
Here is the template I render test.gsp
<table border="0">
<g:each in="${ errors }" var="error">
<tr><td>${ error.address }</td><td>${ error.error}</td><td>${ error.pageLink}</td></tr>
</g:each>
</table>
For now I'm working with a test UI, which means this is not my UI but one I use for testing purposes, say index.gsp
<html>
<body>
<div><p>Pleaseeee, update only the ones below</p></div>
<script type="text/javascript">
function ClickMe(){
setInterval('document.getElementById("auto").click()',5000);
alert("Function works");
}
</script>
<div id="dont't touch">
<g:formRemote url="[controller:'PHP', action:'ajax']" update="ajaxDiv"
asynchronous="true" name="Form" onComplete="ClickMe()" after="ClickMe()">
<div>
<input id="auto" type="button" value="Click" />
</div>
</g:formRemote>
<div id="ajaxDiv">
<g:render template="/PHP/test"/>
</div>
</body>
</html>
The div I'm trying to update is "ajaxDiv". Anyone trying to answer this question can just assume that I dont have an index.gsp and can propose a solution from scratch. This is the first time I'm using Grails in my life so far, and also the first time I'm ever dealing with ajax in any form. The aim is to dynamically fetch data from my database and display the result. Or if someone knows how to directly mirror output from the system console unto the UI, that will also be great.
It sounds like a form would be appropriate for your needs. Check out the Grails documentation on forms. You should be able to render a form with the values you would like without too much trouble. Be sure to pay attention to your mapping and let me know if you have any questions after you have set index.gsp up to render a form for your values.

Resources