Timeout Exception while using Custom action

I tried running this script. It works when a is https://google.com,but throws an exception with https://festivya-2.myshopify.com/admin/auth/login

@CustomScriptAction(
input=['a']

		)
def customScript()
{

openChrome(a.toString())
sleep(10000)

}
1 Like

Hi, @agokulakrishna Welcome to the community!

Probably, the webpage doesn’t have enough time to load.
Try setting a bigger timeout in the Preferences.

Or you can define the timeout right in the Custom script.

@CustomScriptAction(
input=['a']

		)
def customScript()
{
timeouts().pageLoadTimeout(50000, java.util.concurrent.TimeUnit.MILLISECONDS) 

openChrome(a.toString())
sleep(10000)

}
1 Like

Hello,@ashapkina

I will try it out and let you know.

1 Like
@CustomScriptAction(
input=['a']

		)
def customScript()
{
timeouts().pageLoadTimeout(50000, java.util.concurrent.TimeUnit.MILLISECONDS) 

openChrome(a.toString())
sleep(2000)

$(byXpath('//*[@id="account_email"]')).click()
sendKeys(b)
$(byXpath('//*[@id="account_password"]')).click()
sendKeys(c)
$(byXpath('//*[@id="login_form"]/button')).click()

}

ERROR IMAGE.docx (104.5 KB)

You need to use quotes, i.e. sendKeys("b")

Also, you can do all these actions using the Actions Library, there is no need to use Custom Action.

Just trying out basic custom actions ,so that it would help me out with complex ones.

sendKeys(b)

b,actually ,i am trying to print variable.

1 Like

Then you need to specify it in the input.

input=['a','b']

Ah yes!Thank you.

1 Like

Guidelines for using action library vs custom script vs java code(where we will be using it).Any link?

There are no specific guidelines. It all depends on the complexity of the use case you need to implement.

Basically, you should start with the Actions library, if you cannot automate a task with the existing actions - use custom scripts, and if you need to use classes that are not supported in custom actions or if you need to use plugins or some custom capabilities - you have to use the code perspective.

Sure, Thank you.

1 Like