Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Element not found - can't replicate might be your Chrome JavaScript settings #806

Closed
rouilj opened this issue May 24, 2020 · 9 comments
Closed
Labels

Comments

@rouilj
Copy link

rouilj commented May 24, 2020

I realize you have a personal emergency. I hope your mom gets better soon. No urgency on this ticket.

I am using tagui 5.11 to test https:// rouilj.dynamic-dns.net/demo/ (url split to prevent crawlers).
on xubuntu - Ubuntu 18.04.4 LTS.

The following command fails:

tap //fieldset[@id="notifications"]/legend/span/a

with the error:

type search-text as 1
click submit
fetch //input[@name="title"] to issue_title
fetch nosy to nosy_list
demo
snap page to issue1.1.png
tap //fieldset[@id="notifications"]/legend/span/a
ERROR - cannot find //fieldset[@id="notifications"]/legend/span/a

Using the inspector/dev tools in chrome it looks like it should work when logged in as user admin password admin at the url: https:// rouilj.dynamic-dns.net/demo/issue1

The script subset is:

// go to issue 1
type search-text as 1
click submit
// verify title of issue
fetch //input[@name="title"] to issue_title
test.assert(issue_title=="Welcome to the tracker START HERE","check correct title for issue 1")

fetch nosy to nosy_list
echo nosy_list
snap page to issue1.1.png

//close the notifications fieldset
tap //fieldset[@id="notifications"]/legend/span/a  # dies here
snap page to issue1.2.png

From the snapshot issue1.1.png it looks like the 'a' tag item is missing.
That link is created using javascript, and it looks like javascript is not being run on the page.
Javascript is supposed to convert the topics select input into a select2 input widget.
However it appears in the snapshot as a regular select input.

This used to work under an earlier version of tagui. Do I have to do something special now to get javascript to work?

(Also I tried using 6.0, but trying to use it with chromium (hangs) and google-chrome (seg fault) doesn't work. I guess PhantomJS is no longer an option??)

Any ideas?

Thanks.

-- rouilj

@rouilj rouilj changed the title Tagui claiming element not found but it's there Tagui claiming element not found but it should be created by javascript. May 24, 2020
@kensoh
Copy link
Member

kensoh commented May 25, 2020

Thank you @rouilj we'll need all the medical help, well-wishes and prayers.

I can't replicate your issue. There is some outdated code in your script. For eg //input[@name="title"] does not exist on the webpage. It should be //*[@id="issue_entry"]/span. The following works for me and the link to close the notification box works.

https://rouilj.dynamic-dns.net/demo/
type search-text as 1
click submit
show //*[@id="issue_entry"]/span
tap //fieldset[@id="notifications"]/legend/span/a

PhantomJS is still available with -n or -nobrowser switch but I have tried, this website does not seem to work correctly for PhantomJS.

I'm running using the latest Chrome browser on a macOS laptop. Try this, copy your script and my sample script above to another Windows or macOS laptop to see if it works. It might be some settings on your Ubuntu laptop + Chrome that disables JavaScript from running. TagUI will launch Chrome with the default JS settings for the system. On normal Windows and macOS laptops, Chrome should run with JS enabled.

@kensoh kensoh closed this as completed May 25, 2020
@kensoh kensoh reopened this May 25, 2020
@kensoh kensoh changed the title Tagui claiming element not found but it should be created by javascript. Tagui claiming element not found - can't replicate might be your Chrome settings May 25, 2020
@kensoh kensoh added the query label May 25, 2020
@kensoh kensoh changed the title Tagui claiming element not found - can't replicate might be your Chrome settings Element not found - can't replicate might be your Chrome JavaScript settings May 25, 2020
@kensoh
Copy link
Member

kensoh commented May 25, 2020

Also, you can add a live step in your script to do live debugging. Though that should be unlikely to help in this situation if your Chrome browser does not run JavaScript.

@rouilj
Copy link
Author

rouilj commented May 26, 2020 via email

@kensoh
Copy link
Member

kensoh commented May 30, 2020

I've verified that on my macOS laptop, the following works after logging in with admin / admin -

type search-text as 1
click submit
show //input[@name="title"]
click //fieldset[@id="notifications"]/legend/span/a

Thus it seems like some issue with the browser settings on your Linux laptop.

PhantomJS runs JavaScript but it might be it does not work with this website.

I'm using the latest version, I download the https://github.com/kelaberetiv/TagUI/archive/master.zip and overwrite my local copy.

You can modify the file tagui/src/tagui and add a line before that chrome_command line -

echo "$chrome_command $chrome_switches $window_size $headless_switch"

That will try to show the full command used. Then you can try running it manually. Likely you should get the same segmentation error. And would need to search for solution on the web why this is happening for your Chrome on your Linux PC.

PS - my part-time contract with AI Singapore is ending and I'll not be renewing for time being. My colleague @siowyisheng will help support TagUI users through GitHub issues.

@rouilj
Copy link
Author

rouilj commented Jun 7, 2020

Thanks Kenosh.

Didn't look to see it as a shell script.

I found the cause, but not sure what the answer is. The command line is:

google-chrome --user-data-dir=chrome/tagui_user_profile --remote-debugging-port=9222 about:blank --window-size=1366,842

If run with the DISPLAY environment variable set it starts the chrome browser. If run without DISPLAY set it seg faults. Since I ssh without a remote X server I see the segfault.

Should this invocation include --headless? I cn;t see how it would work from CI or a chron job etc if there was no DISPLAY.

Also note that creating an empty chrome subdirectory causes chrome to start by asking the user if chrome should be the default browser and if data should be sent to chrome. So either more flags are needed (to answer/suppress these interactive questions) , the profile directory shouldn't exist, or the profile must exist at the path given.

-- rouilj

@kensoh
Copy link
Member

kensoh commented Nov 23, 2020

Hi John, sorry I was away past few months - tebelorg/RPA-Python#144

Can I check with you if you are still facing issues around this scenario?

For headless mode, the tagui command must be run with the -h or -headless switch. Otherwise the default behaviour will be using a visible Chrome browser. Also, for the first run I believe Chrome browser will always make that prompt.

@rouilj
Copy link
Author

rouilj commented Nov 23, 2020

Hello Ken:

I have a workaround for this, so I'll close it. Glad your back and hope you mom continues her recovery.

Hope you have a great week.

-- rouilj

@rouilj rouilj closed this as completed Nov 23, 2020
@kensoh
Copy link
Member

kensoh commented Nov 23, 2020

Thank you @rouilj ... She was discharged from hospital last weekend, after 6 months.

Condition is still bad but hopefully in a different environment her recovery could go faster.

@kensoh
Copy link
Member

kensoh commented Nov 23, 2020

Thank you, have a nice week!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants