Selenium: selectWindow is not working outside of the testcase - selenium-ide

The test:
Testcase 1 has one selenese: openWindow | ${url} | ${name}
Testcase 2 has one selense: selectWindow | ${name} |
And it returns an error: [error] Could not find window with title ${name}.
If the two selenses are in one testcase, the test passes.
I was looking in the docs: http://release.seleniumhq.org/selenium-remote-control/0.9.2/doc/dotnet/Selenium.DefaultSelenium.SelectWindow.html , but didn't find any related restrictions about the method - you can select windows only opened in the same testcase. Is that a known limitation or am I doing something wrong? Is there a workaround?

Yes that is a known limitation. There may be away around it but I am unaware of it(maybe you could try using a different tab for each test). Your best bet is to use the webdrivers. I have migrated from using the selenium firefox extension to C#, there is no comparison in the benefits of using this.

There is this open bug: https://code.google.com/p/selenium/issues/detail?id=1136
which may be causing what you're seeing. Try selectWindow by another method (instead of the name, look by title)

Related

Charles Proxy Rewrite & MapLocal - how to match exact query

I only want to return certain response specifically for /path/embed=profile&prefetch=true&couples_only=false and NOT embed=profile&prefetch=true&couples_only=false&ANYTHINGELSE
But Charles seems to be treating the 2 queries the same
What I've tried
/path/embed=profile&prefetch=true&couples_only=false? - hoping the ? will match 1 character or nothing, ruling out the wanted longer queries
embed=profile&prefetch=true&couples_only=false(?!&) - standard regex, tested in regexr.com
What else can I do?
From what I remember, it's a bug and it hasn't fixed ever since.
You might try Proxyman, which is similar to Charles and it will solve your problem.
Here is the step:
Setup the certificate on your macOS (Certificate -> Install on macOS)
Make a request
Right-click to show a menu context -> Tool -> Map Local or Breakpoint
Create a rule with default value -> It will match exactly the query as you wish.
For the Map Local, you can modify the local file in the Editor.
For the Scripting (It's the same with ReWrite, but write by Javascript)
Disclaimer: I create this app. Hope that it can help you for daily works.

Bdd Cucumber issues

I have newly started working on BDD Cucumber. I am using scala for writing test cases. I am trying to use Scenario Outline and passing parameters in step definitions. My code is as follows.
Scenario Outline: Data is parsed and persisted
Given Portal is running
When A data of <type> is received
Then The data of <type> with <Id> should be parsed and persisted
Examples:
| type | Id |
| Personal | 1 |
|Professional | 2 |
Now in my when condition I am trying to get these parameters as follows
When("""^A data of \"([^\"]*)\" is received$""") {
(type: String) =>
//My code
}
Now on running my code I am getting following error everytime.
io.cucumber.junit.UndefinedStepException: The step "A data of Personal is received" is undefined. You can implement it using the snippet(s) below:
When("""A data of Personal is received""") { () =>
// Write code here that turns the phrase above into concrete actions
throw new io.cucumber.scala.PendingException()
}
Though I have my code in when. Also If I don't use Scenario Outline then it works fine but I want to use Scenario Outline for my code.
I am using tags in my feature file to run my test cases. When I run my test cases with command sbt test #tag1, test cases executes fine but when all test cases are finished running on cmd I am getting following error:
[error] Expected ';'
[error] #tag1
I tried putting ";" after tag but still getting same error
What is this issue and how I can resolve it?
I have 4-5 feature files in my application. That means 4-5 tags. As of now the test case which I want to run I give path of feature file and "glue" it with step deinition in my Runner Class. How I can provide all the tags in my Runner class so that my application runs all the test cases one by one when started?
You are missing the double quotes around <type>:
When A data of "<type>" is received
Just some general advice.
When cuking keep things as simple as possible, focus on clarity and simplicity, do not worry about repetition.
Your task would be much simpler if you wrote 2 simple scenarios
Scenario: Personal data
Given Portal is running
When personal data is received
Then personal data should be persisted
Scenario: Professional data
...
Secondly don't use tags to run your features, you don't need tags yet.
You can cuke much more effectively if you avoid scenario outlines, regex's, tags, transforms etc. etc.. The main power in Cucumber is using natural language to express yourself clearly. Focus on that and keep it simple ...

get the current view which is displayed to user and verify

I am testing my eclipse rcp app GUI using a tool called RCPTT.
In rcptt, i want to check that a specific editor is opened or not.
right now i am using
get-view "Console" | get-table | is-disabled | verify-false
but this is wrong way to do verification.
using this code, if the console is not opened, than it click on console and do verification.
It passed all time.
So, is there any way to
- first get the current view(which view is displaying currently to user.)
- then verify this view.
Thanks
You can not solve it within ECL, there's no support for this.
However you can solve it with Java code. It's not easy, could be a few hours of work.
1) Write a Java method that detects the name of the active View and returns it as a String
2) Make sure it's part of your application as a static class's static method
3) Invoke it from your ECL script with the invoke-static command
4) Compare the returned value in ECL script to what you've expected
Check methods parseComposites(), viewOrEditorIsFocused() and checkNextComposite() from this tutorial:
https://openchrom.wordpress.com/2011/08/12/capture-a-snapshot-of-the-active-vieweditor-in-a-rcp-application/
You do not need all the code from it and you need some editing too.
If you make an error/typo at points 2) or 3), then RCPTT-runner will simply throw an Exception without further explanation; be careful there.

how to verify text present in placeholder in selenium IDE

I want to verify the text present in placeholder. I have located the element and i am using Assert text command. I've entered the same string in value. On executing it is showing actual value did not match
Use assertAttribute or verifyAttribute command.
Example:
verifyAttribute | css=#search#placeholder | Sample String
Notes:
In the Target column of Selenium IDE, you need to provide the proper path of the element followed by an # sign
and then the name of the attribute. (placeholder in your case)
Using
verifyAttibute will still continue running the test case once an
error is detected while using assertAttribute doesn't.
You need to understand that assertText function can only check static text on your webpage.
You must be getting an error message.
This is perfectly normal.
What can help in this situation is using the assertAttribute or verifyAttribute functions.
Both these functions perform the same task; the former stops the test after receiving an error message in the text box while verifyValue just records the error in the log and runs the next commands.
While giving the target, either specify the XPath or refer by using the name=name#placeholder format.
You can find the name value by inspecting the box with a firefox addon called Firepath which runs with another firefox tool called Firebug. Install them if you don't already have.
Hope this helps!
Xpath contains() is the best way.
driver.find_element_by_xpath('//input[contains(#placeholder,"email")]')
Format : '//tag[contains(#attribute,"value")]'

wsdl2 does not show extended functions in ColdFusion 10

I have a simple test setup:
component displayname="test1" extends="test2"
{
remote Any function ping1() {}
}
component displayname="test2"
{
remote Any function ping2() {}
}
When I cal the cfc using test1.cfc?wsdl something strange happens.
When I tell my application to use WSDL version 1 using this.wssettings.version everything looks fine, pretty much the same as in CF9. But when I tell it to use version 2 the function "ping2" does not show up in my definition xml.
Why doesn't WSDL 2 show my extended function "test2" when I call test1.cfc?wsdl ??
I tried this on ColdFusion 10 and both WSDL and WSDL2 do not show the inherited methods. I only see the ping1() function of the test1.cfc, I do not see ping2() inherited from test2.cfc. If you change the "Select web service version" value in the ColdFusion Administrator from 2 (the default) to 1, then ColdFusion 10 performs as ColdFusion 9 does and shows both methods.
On ColdFusion 9, the WSDL shows both methods.
In my opinion, this is a bug in ColdFusion 10, you should log it with Adobe (https://bugbase.adobe.com/), and post the bug number here so others can vote for it. This could break existing functionality if people upgrade without changing the default web services version.
I tried this exact code on CF 9.01 and did not get the same result. My WSDL shows both methods. Something is unique about your CF install - perhaps the wrong version of Axis or something? I'm sorry I can't be more helpful - but I'm struggling to figure out a way to duplicate your issue.