Search code examples
javaeclipseeclipse-cdtswtbot

Trying a get a tree item in tabItem in swtBot but it is not working


I have attached a image describing my problem, i need to access General under GCC Assembler, i tried to focus on the tabItem with index 0, it came properly to Tool Settings tab but GCC Assembler -> General is not found ! enter image description here

Here is the code:

bot.tree().getTreeItem("test").select();
bot.menu("File").menu("Properties").click();

bot.tree().getTreeItem("C/C++ Build").select();
bot.tree().getTreeItem("C/C++ Build").expand();

bot.tree().getTreeItem("C/C++ Build").getNode("Settings").select();

bot.tabItem(0).activate();
bot.tree().getTreeItem("GCC Assembler").select();
bot.tree().getTreeItem("GCC Assembler").getNode("General").select();
bot.text().getText(); //for getting the assembler flags in General

Solution

  • The tree for GCC Assembler is of index 1! So it has to be

    bot.tree(1).getTreeItem("GCC Assembler").select();
    bot.tree(1).getTreeItem("GCC Assembler").getNode("General").select();
    

    The first tree is the Resource, C/C++build on the left side, this is the second tree in the page.