I have been trying to use RSelenium and cannot figure out how to make an 'if' 'else' statement when using the findElement function. Can anyone help out this basic problem below? This is just a test to understand a piece of my overall code. Basically, I want to see if a page has a term and if it does make a calculation. Many thanks!
Start Selenium Server --------------------------------------------------------
checkForServer()
startServer()
remDrv <- remoteDriver()
remDrv$open()
# Simulate browser session
remDrv$navigate('http://agcensus.dacnet.nic.in/districtsummarytype.aspx')
# Test if the page has the words 'District Tables' then make a calculation
if (remDrv$findElement(using = "xpath", "//*[contains(text(), 'District Tables')]"))
{2+2}
else
{4+4}