Not able to detect a href component in Selenium RC - selenium-rc

I have the following link 'Test' in my application.
<div class="tabUnselectedText" align="center">
Test
</div>
When I tried Selenium IDE it gives me following code. The same code does not work with RC . Please help me out with this
selenium.click("link=Test"); // code generated with Selenium IDE and same does not work with RC. It says element is not
One more case:
<div class="tabUnselectedText" align="center">
Notifications
</div>
15:45:04.627 INFO - Command request: click[link=Test, ] on session 2d985d284
6694d888ee13a986dc8cf67
15:45:04.658 INFO - Got result: ERROR: Element link=Test not found on sessio
n 2d985d2846694d888ee13a986dc8cf67

Xpath: //div[#class='tabUnselectedText']/a

Try with Selenium.ClickAt()

Related

i couldn't type in an element using cypress

I'm trying to fill passwords fields in sign up form using cypress, but it doesn't work with me
my code:
describe("SignUP", function(){
it('OpenSignuoForm',function(){
cy.visit('https://mawadda-eg.com')
cy.get('.tt-tools-button').click();
cy.get('#header > div > nav > div.tt-menu-collapse.tt-submenu-dark > ul > li:nth-child(2) > ul > li:nth-child(2) > a').click();
cy.get('#user_name').type('automation');
cy.get('#e_mail').type('moatazqc+100#gmail.com');
cy.get('#password').type('test');
})
})
After checking the website attached , It didn't work because that id is duplicated, use another css selector , or locate with XPath with this locator (//input[#id='password'])[1]
Detailed Answer for using XPath locators in cypress.
In cypress the default locator strategy is using the CSS-Selectors using the normal cy.get() , but if we would like we can also locate elements using the XPath plugin https://github.com/cypress-io/cypress-xpath .
How to install and use it
install it with yarn yarn add cypress-xpath --dev
Then include in the project support file cypress/support/index.js as
require('cypress-xpath')
Use it in any it test with cy.xpath() and you can chain it same as you chain cy.get()
so the final code you can locate and type on the element in the question should be
cy.xpath("(//input[#id='password'])[1]").type("test");

Selecting local files using watir-webdriver

I'm attempting to automate the process of selecting a local file from a html page using watir-webdriver
I have the following html
<body>
<form method="post" action="upload" enctype="multipart/form-data">
test file to upload: <input type="file" name="file" size="60" id="test"/>
<input type="submit" value="Upload" name="upload" id="upload" />
</form>
</body>
I'm attempting to click the input with an id of test and set a path to the local file I wish to upload using watir-webdriver.
I can use the following to click the button to bring up the selection window using
#browser.goto 'http://www.test.com'
#browser.button(:id => 'test').click
however, i'm trying to use the following (from researching, this seems the correct way. not working though)
#browser.file_field(:name => 'file').set("C:\\path\\to\\test\\file\\validTest.xml")
which results in the following error
Watir::Exception::UnknownObjectException: unable to locate element, using {:name=>"file", :tag_name=>"input", :type=>"file"}
trying
#browser.button(:id => 'test').set("C:\\path\\to\\test\\file\\validTest.xml")
results in the following error
NoMethodError: undefined method `set' for #<Watir::Button:0x3859920>
Can anyone help? I'm struggling to understand why the file_field option doesn't work.
Try using the following function:
#browser.file_field(:id,"upload").set("filepath")
Also, if you are using IE browser then make sure you are using IEDriverServer_Win32_2.33.0 as it works fine on this driver not on latest one.
Try this:
#browser.file_field(:id => 'test').set("C:\\path\\to\\test\\file\\validTest.xml")
Try using like this in latest IEDriver.
assign file path to variable and then set it
filepath = "C:\\path\\to\\test\\file\\validTest.xml"
#browser.file_field(:id,"upload").set(filepath)

Adding fields to Joomla 3.x contact component

I need to add fields to the joomla 3.x com_contact component. I have found some instructions via google search but they are all for earlier versions (i.e. 2.5) of Joomla.
I know there are other components on the extensions.joomla.org site, but they are not what I want. And I am not looking for contact form components. I don't need to create forms.
I tried adapting the 2.5 modifications I found for 3.x but they don't work. At least I could not get them to work.
Here's the closest I found to doing this. But it is for joomla 2.5 and the steps appear to be different for 3.x based on my attempts to do this.
How to do it but apparently not for Joomla 3.x
Does anyone have step-by-step directions on how to do this?
Thanks!
If you want add fields to Joomla 2.5.x/3.x ‘Contact Form’ do these steps:
(I want to add ‘telephone’ field)
1- Go to *Joomla Directory > components > com_contact > models > forms*
Open ‘contact.xml’ file.
2- Add this code to the file between ‘fieldset’ element:
<field name="contact_telephone"
type="text"
id="contact-telephone"
size="30"
description="Your Number for Contact"
label="Phone"
filter="string"
required="true"/>
3- Go to *Joomla Directory > components > com_contact > views > contact > tmpl*
Open ‘default_form.php’ file.
4- Find this code in the file:
<legend><?php echo JText::_('COM_CONTACT_FORM_LABEL'); ?></legend>
and add this code between element:
<dt><?php echo $this->form->getLabel('contact_telephone'); ?></dt>
<dd><?php echo $this->form->getInput('contact_telephone'); ?></dd>
5- Go to *Joomla Directory > components > com_contact > controllers*
Open ‘contact.php’ file.
6- Find ‘_sendEmail’ function
[find this code: private function _sendEmail($data, $contact) ]
and add this code in the function:
$telephone = $data['contact_telephone'];
and then change this code
$body = $prefix."\n".$name.' <'.$email.'> '."\r\n\r\n".stripslashes($body);
to
$body = $prefix."\n".$name.' ('.$email.', '.$telephone.') '."\r\n\r\n".stripslashes($body);
I added the variable $telephone in that line.
Now, emails contain the telephone-number from the sender.
This worked perfectly for me!
On Step number 4 IF YOU`RE USING A TEMPLATE, then you go to:
*Joomla Directory > templates > your_template_folder_name > html > com_contact > contact > and ppen ‘default_form.php’ file.

Plugin missing while using ajax prototype in Grails 2?

Hello..I'm using Grails 2 and tried to implement the ajax call from gsp page to my controller..At first library prototype was missing in grails 2 i solve this using command grails install-plugin prototype..Now that error is not coming but not working and different error is coming..
Here by i attached the code..I'm trying simple update second select box if i change the first
As well i added grails.views.javascript.library = "prototype" this line in Config.groovy
<code>
//Controller<br>
def ajaxgetStrudents() {
def college=College.get(params.id)
render college?.students as JSON
}
//GSP<br>
javascript library="prototype" plugin="prototype"<br>
<g:select id="name" name="name" from="${collegeNames.name }"
onChange="${ remoteFunction(controller:'College', action:'ajaxgetStrudents',
, onComplete: 'updateStudent(e)',params :'\'id=\'+this.value '
)}
`</code>
And i wrote javascript code to fill student select box..This code is not working..In console error coming like this
` Error 2012-10-08 01:16:57,933 [http-bio-8083-exec-6] ERROR [/SampleGrails].[default] - Servlet.service() for servlet [default] in context with path [/SampleGrails] threw exception
Message: It looks like you are missing some calls to the r:layoutResources tag. After rendering your page the following have not been rendered: [defer]
Line | Method
->> 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
`
First i want to make run of this code..??
Next even though i installed the prototype plugin that was not added in my project plugin folder..but it was showing in grails list-plugin -installed command..why it is..??
Thanks..,
Prototype has been dropped from Grails 2.1.0 onwards (Not sure about 2.0.3)
Replace
<g:javascript library="prototype" plugin="prototype" />
With
<g:javascript library="prototype" plugin="prototype" />
<r:layoutResources/>
Hope that helps. Always refer to the documentation available. This one is a link to upgrading grails, have a lot of info though Grails 2.1.x
The correct way to install plugin in grails 2.x is to put an entry in BuildConfig.groovy instead of "install plugin" command.
Also to troubleshoot, you could try "Firebug" in Firefox and see if prototype scripts are getting loaded.
Heading ## - List item
Iam having same issue with prototype,unable to include prototype.js in my grails application.Basically iam using both jquery and prototype and including library using following snippets.
`
The issue comes as gsp unable to load the prototype plugin due to this my prototype ajax is not working and getting following exception.
After rendering your page the following have not been rendered: [defer] Line | Method ->> 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
I think you simply missed "update" property in the remoteFunction call.

Crystal Report Export & Print Button in Viewer Not working

Am Dispalying a crystal report using javascript Popup :
window.open("reports_1_cox.aspx");
Aspx :
<CR:CrystalReportViewer ID="coxReportIdVw" runat="server" Height="50px"
ToolPanelWidth="200px" Width="350px"/>
I can see the report is loaded properly but when I am trying to export or print the report it is throwing me this error :
Failed to export using the options you specified. Please check your options and try again.
have tried placing Viewer in Update Panel but no luck.
Have copied this folder crystalreportviewers13 from my BuisnessObjects installed folder to my app path and it worked properly.

Resources