We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
Task: Record a TestComplete script that will go to a user profile page (@TanyaGorbunova in our case) and get the number of Solutions for a specific community member.
This is a solution created for [TechCorner Challenge #7]
function GetSolNumber()
{
//Open the user profile page
Browsers.Item(btChrome).Navigate("https://community.smartbear.com/t5/user/viewprofilepage/user-id/1737");
// Get the number of the solutions
var ProfilePage = Sys.Browser().Page("*");
//Get the name of the profile
var name = ProfilePage.QuerySelector('span.login-bold').contentText;
// Identify the Solutionsdiv
var solutionSec = ProfilePage.QuerySelector('div.UserSingleStatistic.lia-statistic-net_accepted_solutions.lia-component-users-widget-single-statistic div.lia-statistic-value');
// Check the result
if (solutionSec != null)
// If the element was found, display the number of Solutions for the selected community member.
{
Log.Message("the number of Solutions for the profile of the member " + name + " is: " + solutionSec.contentText);
}
else
// If the element was not found, post a warning to the log
Log.Warning("The element was not found.");
}
Task: Record a TestComplete script that will go to a user profile page (@TanyaGorbunova in our case) and get the number of Solutions for a specific community member.
This is a solution created for [TechCorner Challenge #7]
Hi All,
Was unsure of how to post a keyword test, so here is a screengrab of it from TestComplete
My test uses Keyword with some scripted routine
Where the script is removing the "solutions" text from the ContentText of the mapped area,
function StringReplace(text)
{
var str = aqString.Replace(text, "Solutions", "");
return str
}
Resulting in:
Task: Record a TestComplete script that will go to a user profile page (@TanyaGorbunova in our case) and get the number of Solutions for a specific community member.
This is a solution created for [TechCorner Challenge #7]
function GetSolNumber()
{
//Open the user profile page
Browsers.Item(btChrome).Navigate("https://community.smartbear.com/t5/user/viewprofilepage/user-id/1737");
// Get the number of the solutions
var ProfilePage = Sys.Browser().Page("*");
//Get the name of the profile
var name = ProfilePage.QuerySelector('span.login-bold').contentText;
// Identify the Solutionsdiv
var solutionSec = ProfilePage.QuerySelector('div.UserSingleStatistic.lia-statistic-net_accepted_solutions.lia-component-users-widget-single-statistic div.lia-statistic-value');
// Check the result
if (solutionSec != null)
// If the element was found, display the number of Solutions for the selected community member.
{
Log.Message("the number of Solutions for the profile of the member " + name + " is: " + solutionSec.contentText);
}
else
// If the element was not found, post a warning to the log
Log.Warning("The element was not found.");
}
Conrgats SiwarSayahi ! This works great🙂
By the way, the https://support.smartbear.com/testcomplete/docs/testing-with/object-identification/name-mapping/xpath-expressions-and-css-selectors.html in TestComplete makes it much easier to work with CSS and XPath selectors. It allows you to copy selectors from Object Spy and create a script manually, or record a test as usual - TestComplete will automatically use selectors when mapping objects.