How to change a form action using Javascript and Selenium in JAVA
<p>I've been trying to replace the action attribute of a form using javascript and selenium in JAVA, but I can't get it to work. </p>

<p>This is the site's snippet HTML:</p>

<pre><code>&lt;/div&gt;
&lt;div class="contionue-shopping-wrapper"&gt;
&lt;form class="co-formcontinueshopping" action="https://www.yahoo.com" method="post" id="dwfrm_cart_d0jilurhcxpm"&gt;
&lt;fieldset&gt;
&lt;button class="rbk-button-red button-primary bp-black right" type="submit" value="Continue Shopping" name="dwfrm_cart_continueShopping"&gt;
&lt;span&gt;Continue Shopping&lt;/span&gt;
&lt;/button&gt;
&lt;/fieldset&gt;
&lt;/form&gt;
&lt;/div&gt;
</code></pre>

<p>This is what I've done in JAVA in an attempt to change the action above</p>

<pre><code>String link = "https://www.google.com"
((JavascriptExecutor)atc).executeScript("document.getElementsByClassName('co-formcontinueshopping')[0].action="+link);
</code></pre>

<p>(note: atc is the Selenium chrome webdriver and site is loaded at this stage)</p>

<p>EDIT: I think if I convert the following javascript to above it'll work?</p>

<pre><code>document.getElementById(document.querySelector("[id^='dwfrm_cart']").id).action = url})()
</code></pre>