Uploaded image for project: 'Arquillian Graphene'
  1. Arquillian Graphene
  2. ARQGRA-232

Enriched WebElement cannot be converted to JSON without manual unwrapping

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 2.0.0.Alpha3
    • Component/s: None
    • Labels:
      None
    • Sprint:
      Sprint 2
    • Workaround Description:
      Hide
      public WebElement unwrap(WebElement element){
         WebElement result=element;
         while (GrapheneProxy.isProxyInstance(result)) {
            result = ((GrapheneProxyInstance) result).unwrap();
         }
         return result;
      }
      
      Show
      public WebElement unwrap(WebElement element){ WebElement result=element; while (GrapheneProxy.isProxyInstance(result)) { result = ((GrapheneProxyInstance) result).unwrap(); } return result; }

      Description

      When you use something like this, WebElementToJsonConverter cannot convert enriched input:

      @FindBy(css="input[id$=input]")
      WebElement input;
      
      public void blurInput(){
              JavascriptExecutor js = (JavascriptExecutor) GrapheneContext.getProxy();
      >>>        js.executeScript("jQuery(arguments[0]).trigger('blur')", input);  <<<
      }
      

      error:

      java.lang.IllegalArgumentException: Argument is of an illegal type: $Proxy37
      	at org.openqa.selenium.remote.internal.WebElementToJsonConverter.apply(WebElementToJsonConverter.java:78)
      	at com.google.common.collect.Iterators$8.next(Iterators.java:730)
      	at com.google.common.collect.Lists.newArrayList(Lists.java:136)
      	at com.google.common.collect.Lists.newArrayList(Lists.java:117)
      	at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:437)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.invokeReal(GrapheneProxyHandler.java:200)
      	at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler$1.invoke(GrapheneProxyHandler.java:134)
      	at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.invoke(GrapheneProxyHandler.java:164)
      	at org.jboss.arquillian.graphene.proxy.GrapheneProxyHandler.intercept(GrapheneProxyHandler.java:172)
      	at org.openqa.selenium.firefox.FirefoxDriver$$EnhancerCGLIB$$cd9d0009.executeScript(<generated>)
      

      Missing some interface in created proxy?

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                lfryc Lukáš Fryč
                Reporter:
                jstefek Jiří Štefek
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 30 minutes
                  30m
                  Remaining:
                  Remaining Estimate - 30 minutes
                  30m
                  Logged:
                  Time Spent - Not Specified
                  Not Specified