I have a drop down box with the id = PoolsSelect. I am trying to select the value within that drop down box but I'm getting an error, here is my code:
RenderedWebElement element = (RenderedWebElement) driver.findElement(By.id("PoolsSelect"));
RenderedWebElement target = (RenderedWebElement) driver.findElement(By.name("Austria"));
element.dragAndDropOn(target);
and the error I get is
Error: Unable to find element by name using "PoolsSelect" (7)
I am using selenium 2.07a with JUnit 4.8.2.
You say the id of the select is PoolsSelect but yet you're using a By.name selector. Have you tried selecting by id?
Related
I need to search specific row in the web dynamic table with selenium java in chrome driver. I have tried using xpath but I'm able to search only those rows which is displaying on current window, it seems it's not scrolling to check the below rules.
For ex. I have web dynamic table with almost 5k rows. if i opened the table in chrome it will display 22 rows and other will shown after i scroll down the page, So I'm able to search rows only within 22 rows..
is there any way to check all the rows and give me the exact row ??
I have tried like this...
//tbody/tr/td/div/span[text()='12345'] -->Created custom xpath for getting estId
String path = "//tbody/tr/td/div/span[text()='"+estId.get(id)+"']";
testElement = driver.findElement(By.xpath(path));
parent = driver.getWindowHandle();
if (estId.get(id).equals(testElement.getText())) {
flag = true;
break;
}
This may not be the exact solution you are looking for. But thats the idea.
List<WebElement> listRows = driver.findElements(By.xpath(".//tbody/tr"));
for(WebElement e: listRows){
if(e. findElement(By.xpath(".//td/div/span")).getAttribute("innerText").equals("12345")){
flag = true;
break;
}
}
I am trying to generate Ikm with Derived table statement in source command.
I can able to set source command but not able to check the check box "Derived table statement" as shown in picture below.
The code I was trying is
SqlGroupType pSqlGroupType = Expression.SqlGroupType.CONSTANT;//valueOf("SQLQUERY");
String exp="(<%=odiRef.getUserExit(“SQLQUERY”)%>)";
Expression pExpression= new Expression(exp, pCrossRefs, pSqlGroupType);
pSourceCommand.setExpression(pExpression);;
Collection<ProcedureOption> pGenerationConditions=null;
ob.addLine("SQLQUERY", pTargetCommand, pSourceCommand, pGenerationConditions);
OdiIKMLine pLine =null ;
ob.setDerivedSelectStatementLine(pLine);
Using drools decision table with spreadsheet I was able to make this:
decision table with xls file
But in workbench I can´t
guided decision table
The error I was getting is:
Unable to Analyse Expression entrega.setSeq1( ""number|"+entrega.getNumeroML|()" );:
[Error: unable to resolve method using strict-mode: org.drools.core.spi.KnowledgeHelper.verbalizar()]
[Near : {... rega.setSeq1( ""number|"+entrega.ge ....}] ^ [Line: 5, Column: 0]
How to set a fact value in action?
Thanks
RESOLVED:
From:
https://groups.google.com/forum/#!topic/drools-usage/ZM76HPQ62cU
Create a "Action BRL Fragment" (you'll need to click the "Include advanced options" on the new column dialog).
With this you can either:-
(1) Add "free form DRL" and enter entrega.setSeq1( "number|"+entrega.getNum() );
(2) Select "modify entrega", select the Seq1 field and use a "formula" for the value entering "number|"+entrega.getNum()
I created a selenium code that automatized tests in my website.
In one screen I run a query, and the system shows in my IE screen the result of this query, as a table.
And then I need to select and click on a line of this table.
I try do this using the code below, but the result in Eclipse is that it cannot find the element 0531025836 even though it's present in the table results on my screen.
driver.findElement(By.xpath("//td[contains(.,'0531025836')]")).click();
I've never seen that XPath before (but I'm not very proficient with XPath compared to some here).
If you are looking for a statement to select an element with exactly that text, try //td[.='0531025836'].
If you are looking for a statement to select an element containing that text, try //td[contains(text(),'0531025836')]
As per my understanding you are dealing with the webTables. If I am correct then there are multiple examples you can find on google for that like the one given below.
WebDriver driver=new FirefoxDriver();
driver.manage().window().maximize();
driver.get("http://money.rediff.com/");
WebElement element=driver.findElement(By.id("allpage_links"));
List<WebElement> rowCollection=element.findElements(By.xpath("//*[#id='allpage_links']/tbody/tr"));
System.out.println("Number of rows in this table: "+rowCollection.size());
//Here i_RowNum and i_ColNum, i am using to indicate Row and Column numbers. It may or may not be required in real-time Test Cases.
int i_RowNum=1;
for(WebElement rowElement:rowCollection)
{
List<WebElement> colCollection=rowElement.findElements(By.xpath("td"));
//now here you have list of webelements of the table, you can perform
//any event on that as per your reqirement
int i_ColNum=1;
for(WebElement colElement:colCollection)
{
System.out.println("Row "+i_RowNum+" Column "+i_ColNum+" Data "+colElement.getText());
i_ColNum=i_ColNum+1;
}
i_RowNum=i_RowNum+1;
}
driver.close();
I am developing a web application using JSP & Servlet (IDE: Eclipse, Database: Oracle10). I am using jqGrid to display records in tabular format.
code snippet:
{name:'CITY',index:'CITY', width:70,editable:true,edittype:"select",editoptions: {dataUrl: 'ProfileServ?action=comboCity', dataEvents: [{ type: 'change', fn: function(e) {alert(this.value);city= this.value;}}],}},
{name:'PIN',index:'PIN', width:200,sortable:false,editable:true, edittype:"select",editoptions: {dataUrl: 'ProfileServ?action=comboPin'}},
I want to change values of PIN according to the value selected in CITY. I have used dataEvents and type: 'change' to get the selected value of CITY. I am successfully getting the selected value of CITY.
My question is that how should I update the values of PIN when value of CITY is changed?
Unfortunately there is no easy way to implement dependent selects. One have to update the whole <select> of dependent select manually inside of change callback (update selects of PIN in your case). The only which I can suggest you is examining the code of the demo from the answer. It is not exactly what you need because it don't use dataUrl, but it shows what should be done.