In the process of writing a stun alching script I noticed that after calling castSpellOnEntity(HIGH_ALCH) then calling hoverSpell(STUN). The next call of castSpell(STUN) will not process until after the previous call of castSpellOnEntity(HIGH_ALCH).
To better summarize: cast high alch -> hover cursor over stun -> pause until after high alch completes -> cast stun.
However by replacing hoverSpell() with a call to Mouse.move() with random coordinates within the bounds of the st
To check if a tab is open, use Tabs#isOpen. For example: getTabs().isOpen(Tab.MAGIC)
The return values speak for themselves. About the other problem, I think your solution works fine but you'll need to open the tab first which can be done with Tabs#open.