Re: [appium-discuss] Appium: 'SyntaxError: Unexpected reserved word' for 'import'

697 views
Skip to first unread message

Jonathan Lipps

unread,
Jun 12, 2013, 11:56:13 AM6/12/13
to Charlie Seligman, appium-...@googlegroups.com
node is for running javascript, not for running java. you'll need to use maven or something else I guess.

On Jun 12, 2013, at 11:27 AM, Charlie Seligman <charlie....@gmail.com> wrote:

Hi there,

I have managed to get the simplest.js test running on my Mac.

I then went into my current project's folder and installed appium and wd.

Now when I run the following in the terminal:
node src/GiaTestSuite.java

I get the following error:

/Users/cseligman/Documents/ios-automation/Appium_GIA/src/GiaTestSuite.java:3
import general.LogDriver;
^^^^^^
SyntaxError: Unexpected reserved word
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3



It seems to be picking up the first import in my GiaTestSuite.java file and not liking it.  Here is the start of that file:

import general.LogDriver;

import java.util.List;
import java.util.concurrent.TimeUnit;
import java.net.URL;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.*;

import pageObjects.ArticlePage;
import pageObjects.EditHomePage;
import pageObjects.EditSectionsPage;
import pageObjects.HomePage;
import pageObjects.SettingsPage;

import static org.junit.Assert.*;


public class GiaTestSuite {   
    private WebDriver driver;
   
    @Before
    public void setUp() throws Exception {
        LogDriver.logMessage("@Before");
       
        // Setup Appium       
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, "iOS");
        capabilities.setCapability(CapabilityType.VERSION, "6.1");
        capabilities.setCapability(CapabilityType.PLATFORM, "Mac");
        capabilities.setCapability("app", "/Users/cseligman/Library/Developer/Xcode/DerivedData/Guardian-ddqdbljqpdchfbbtnziuwncvseou/Build/Products/Debug-iphonesimulator/Guardian-ROW.app");
//        capabilities.setCapability("app", "/Users/cseligman/Library/Developer/Xcode/DerivedData/TestApp-fimydakgvyetqdbzwumaodihsbiy/Build/Products/Debug-iphonesimulator/TestApp.app");
        driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
       
        // Ensure users is subscribed
        HomePage homepage = new HomePage(driver);
        if (homepage.isUserSubscribed() == false) {
            LogDriver.logMessage("TESTS WILL FAIL - USER NOT LOGGED IN");
        }
    }



Has anyone come across this issue before or knows a way to resolve it?

Cheers,

Charlie

--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Jason Carr

unread,
Jun 12, 2013, 11:57:37 AM6/12/13
to Charlie Seligman, appium-...@googlegroups.com
Hey Charlie,

Looks like you have some familiarity with Selenium - just run this script the same way you would run your other selenium scripts, and the desired capabilities settings you have will direct commands to appium, which will take over from there.

Saikat Maitra

unread,
Jun 28, 2013, 11:00:38 AM6/28/13
to Charlie Seligman, appium-...@googlegroups.com
Hello Charlie

I have similar requirement for my project. I am writing a maven plugin to start/stop appium server. 

Regards
Saikat  


On Fri, Jun 28, 2013 at 4:33 PM, Charlie Seligman <charlie....@gmail.com> wrote:
Hi everyone,

So managed to get "mvn clean test" to run all my appium iOS tests using Terminal.  However, for these tests to run I need to have Appium open on the Mac and 'Launched'.   Is there anyway to automate the launching of Appium via Terminal as well?

Cheers,

Charlie


On Thursday, June 13, 2013 3:13:46 PM UTC+1, Charlie Seligman wrote:
Perfect - thanks guys for the replies.

Just in case anyone else has a similar issue with this, I would recommend looking at this website - great explanation on setting up Maven with Selenium WebDriver: http://www.wunderkraut.com/blog/creating-and-running-a-simple-selenium-webdriver-test/2011-09-15

Cheers, Charlie

Jonathan Lipps

unread,
Jun 28, 2013, 12:09:01 PM6/28/13
to Saikat Maitra, Charlie Seligman, appium-...@googlegroups.com
You guys could run appium from source or npm instead of using the .app. All the .app does is call appium from the command line underneath the hood anyway.
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages