Comments (6)
Hi Jess,
the two XPath expressions are not the same:
Passes:
//form[.//*
Fails:
.//*[(local-name(.)="input"
Some short code replicating the situation, or ideally, the actual, ideally self-contained HTML page (+JS) to reproduce the problem would help me diagnose this far better...
from www-mechanize-chrome.
Yup I see they arent, yet they both get used to find fields in a form..
We're trying to login to: https://www.amazon.co.uk/gp/yourstore/iyr/ref=pd_ys_iyr_edit_watched?ie=UTF8&collection=watched (which presents a signin page if not logged in)
Code:
my $mech = WWW::Mechanize::Chrome->new(
#tab => qr/amazon/,
autoclose => 0,
launch_exe => '/usr/bin/google-chrome-stable',
host => 'localhost',
background_networking => 0,
autodie => 1,
report_js_errors => 1,
incognito => 1,
);
$mech->allow( javascript => 1 );
#my $mech = WWW::Mechanize->new();
say "Created mechanize, getting initial page.";
$mech->get('https://www.amazon.co.uk/gp/yourstore/iyr/ref=pd_ys_iyr_edit_watched?ie=UTF8&collection=watched');
say "Loaded first-level form, waiting until visible";
$mech->wait_until_visible(
selector => '#ap_email',
timeout => 30
);
say "Waited until visible";
if($mech->is_visible(selector => '#ap_email')) {
say "Yup, visible";
}
{
open my $fh, ">", "login_1.html" or die;
print $fh $mech->content;
}
$mech->dump_forms;
## Works:
$mech->form_name('signIn');
# Just checking.. yup its there:
my @text = $mech->selector('#ap_email');
say $_->get_attribute('outerHTML') for @text;
# Works
$mech->form_with_fields('email', 'password');
print $mech->current_form()->get_attribute('outerHTML');
# Fails!
$mech->submit_form(with_fields => {email => '[email protected]'});
say "Submitting form";
from www-mechanize-chrome.
v 0.42, now on CPAN should fix this problem.
Thank you for providing code to reproduce the issue!
from www-mechanize-chrome.
Awesome, thanks!
from www-mechanize-chrome.
works!
Did you intend to break: $mech->current_form()->get_attribute('outerHTML'); btw? it now prints HASH(0x...) instead of the HTML (we were just using it for debugging)
from www-mechanize-chrome.
Oops - no, that was not intended (and also not in the test suite ...)!
Thanks for finding this and telling me, I'll release a fix soon!
from www-mechanize-chrome.
Related Issues (20)
- Referer header not working HOT 4
- The content is always wrapped in HTML HOT 5
- Can't connect without knowing the port?! 0 at .../Chrome/DevToolsProtocol.pm line 317. HOT 2
- Sleep statements needed in code to avoid errors HOT 8
- "'Page.navigate' wasn't found" when calling `get` on a page that's already loaded
- Can't locate object method "port" via package "URI::_generic" at .../perl/5.28.1/WWW/Mechanize/Chrome.pm line 1033. HOT 5
- Add support for POST form submission HOT 2
- Chrome/Chromium v97 closes CDP websocket while setting up a new instance HOT 1
- Windows 11, Strawberry Perl 5.32 64 bit. Install fails HOT 2
- VERY slow on xpath getting TDs of a TR HOT 4
- Use of @_ in numeric eq (==) with signatured subroutine is experimental HOT 4
- Failing on Windows (Not directly a WWW::Mechanize::Chrome issue) HOT 1
- WWW::Mechanize::Chrome->new hangs when --remote-allow-origins= is not set HOT 3
- Could not find node with given id HOT 1
- Test freezes on Win10, strawberry 5.32.1 HOT 1
- Constructor param data_directory has no effect but it is present in the launch args
- Could not read websocket endpoint from Chrome output because of 10 lines limit in sub read_devtools_url HOT 1
- Running version 0.71 on Perl 5.36 produces a lot of warnings HOT 1
- html to pdf is not working
- Installing (testing) in Linux as root enters infinite loop HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from www-mechanize-chrome.