We can test based on attributes of elements by using css. We can use regular expression in css attributes to identify the element.
If your element is in this css format.
This will store the "barfoo" in str variable because element <a name="barfoo">barfoo</a> name ends with "foo"
How to store the text of and element which css attributes starts with any letters and ends with any letters but containing some specific letters in middle.
Ex. in above element how to store the text whose element name ends with any letter and ends with any letter but containing some specific letters "zoo"
<div id="combinatorTest">this is the parent element. <span id="firstChild">this is a child element <a>and grandson element</a></span>, <span>another child element</span>, <span>last child element<span></span></span></div>
How to store the text of preceding combinator element in RC
Sometimes waitForPageToLoad() and pause fails then to handle this condition we just need to wait for an element we are waiting to load on the page. Once its loaded our execution should proceed.
boolean Condition = false;
for (int second = 0; second < 60; second++) {
try {
if ((selenium.isElementPresent("//a[@id='overridelink']"))) {
selenium.click("//a[@id='overridelink']");
Condition = true;
break;
selenium.waitForPageToLoad(MAX_WAIT_TIME_IN_MS);
}
}
catch (Exception ignore) {
}
pause(1000);
}
assertTrue(Condition);
Selenium creates a new and clean profile each time it runs a test, so it won't keep any cookies of the previous session and it wont use any browser plug-in however you can force selenium to use your own profile.
Steps
1. Close all instances of firefox browser.
2. Create a new firefox profile : Go to Run and type firefox -p and press OK . This will open a dialog bod where you create new firefox profile, have a name "nk" and save it in C: drive.
3. Install all plug-ins in this profile ; For SSL certificate issue install SSL security bypass
Selenium creates a new and clean profile each time it runs a test, so it won't keep any cookies of the previous session and it wont use any browser plug-in however you can force selenium to use your own profile.
Steps
1. Close all instances of firefox browser.
2. Create a new firefox profile : Go to Run and type firefox -p and press OK . This will open a dilog bod where you create new firefox profile, have a name "nk" and save it in C: drive.
3. Start the browser: Go to run and type firefox -p that will open a dialog box. Select the profile "NK" which you created in the 2nd step.
4. Install all plug-ins in this profile ; like SSL security bypass