diff --git a/scrapy/http/request/form.py b/scrapy/http/request/form.py
index a12a2fd07..4a9bd732e 100644
--- a/scrapy/http/request/form.py
+++ b/scrapy/http/request/form.py
@@ -11,6 +11,7 @@ from parsel.selector import create_root_node
 import six
 from scrapy.http.request import Request
 from scrapy.utils.python import to_bytes, is_listlike
+from scrapy.utils.response import get_base_url
 
 
 class FormRequest(Request):
@@ -44,7 +45,7 @@ class FormRequest(Request):
 
 def _get_form_url(form, url):
     if url is None:
-        return form.action or form.base_url
+        return urljoin(form.base_url, form.action)
     return urljoin(form.base_url, url)
 
 
@@ -58,7 +59,7 @@ def _urlencode(seq, enc):
 def _get_form(response, formname, formid, formnumber, formxpath):
     """Find the form element """
     text = response.body_as_unicode()
-    root = create_root_node(text, lxml.html.HTMLParser, base_url=response.url)
+    root = create_root_node(text, lxml.html.HTMLParser, base_url=get_base_url(response))
     forms = root.xpath('//form')
     if not forms:
         raise ValueError("No <form> element found in %s" % response)

[Bug] Incorrectly picked URL in `scrapy.http.FormRequest.from_response` when there is a `<base>` tag
## Issue Description

Incorrectly picked URL in `scrapy.http.FormRequest.from_response` when there is a `<base>` tag.

## How to Reproduce the Issue & Version Used

```
[pengyu@GLaDOS tmp]$ python2
Python 2.7.10 (default, Sep  7 2015, 13:51:49) 
[GCC 5.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import scrapy
>>> scrapy.__version__
u'1.0.3'
>>> html_body = '''
... <html>
...     <head>
...         <base href="http://b.com/">
...     </head>
...     <body>
...         <form action="test_form">
...         </form>
...     </body>
... </html>
... '''
>>> response = scrapy.http.TextResponse(url='http://a.com/', body=html_body)
>>> request = scrapy.http.FormRequest.from_response(response)
>>> request.url
'http://a.com/test_form'
```

## Expected Result

`request.url` shall be `'http://b.com/test_form'`

## Suggested Fix

The issue can be fixed by fixing a few lines in `scrapy/http/request/form.py`
diff --git a/tests/test_http_request.py b/tests/test_http_request.py
index ff0941961..60fd855dd 100644
--- a/tests/test_http_request.py
+++ b/tests/test_http_request.py
@@ -801,6 +801,25 @@ class FormRequestTest(RequestTest):
         self.assertEqual(fs[b'test2'], [b'val2'])
         self.assertEqual(fs[b'button1'], [b''])
 
+    def test_html_base_form_action(self):
+        response = _buildresponse(
+            """
+            <html>
+                <head>
+                    <base href="http://b.com/">
+                </head>
+                <body>
+                    <form action="test_form">
+                    </form>
+                </body>
+            </html>
+            """,
+            url='http://a.com/'
+        )
+        req = self.request_class.from_response(response)
+        self.assertEqual(req.url, 'http://b.com/test_form')
+
+
 def _buildresponse(body, **kwargs):
     kwargs.setdefault('body', body)
     kwargs.setdefault('url', 'http://example.com')

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
apt-get update apt-get install -y gcc libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==25.3.0
Automat==24.8.1
cffi==1.17.1
constantly==23.10.4
coverage==7.8.0
cryptography==44.0.2
cssselect==1.3.0
exceptiongroup==1.2.2
execnet==2.1.1
hyperlink==21.0.0
idna==3.10
incremental==24.7.2
iniconfig==2.1.0
jmespath==1.0.1
lxml==5.3.1
packaging==24.2
parsel==1.10.0
pluggy==1.5.0
pyasn1==0.6.1
pyasn1_modules==0.4.2
pycparser==2.22
PyDispatcher==2.0.7
pyOpenSSL==25.0.0
pytest==8.3.5
pytest-asyncio==0.26.0
pytest-cov==6.0.0
pytest-mock==3.14.0
pytest-xdist==3.6.1
queuelib==1.7.0
-e git+https://github.com/scrapy/scrapy.git@dd9f777ba725d7a7dbb192302cc52a120005ad64#egg=Scrapy
service-identity==24.2.0
six==1.17.0
tomli==2.2.1
Twisted==24.11.0
typing_extensions==4.13.0
w3lib==2.3.1
zope.interface==7.2

name: scrapy
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==25.3.0
      - automat==24.8.1
      - cffi==1.17.1
      - constantly==23.10.4
      - coverage==7.8.0
      - cryptography==44.0.2
      - cssselect==1.3.0
      - exceptiongroup==1.2.2
      - execnet==2.1.1
      - hyperlink==21.0.0
      - idna==3.10
      - incremental==24.7.2
      - iniconfig==2.1.0
      - jmespath==1.0.1
      - lxml==5.3.1
      - packaging==24.2
      - parsel==1.10.0
      - pluggy==1.5.0
      - pyasn1==0.6.1
      - pyasn1-modules==0.4.2
      - pycparser==2.22
      - pydispatcher==2.0.7
      - pyopenssl==25.0.0
      - pytest==8.3.5
      - pytest-asyncio==0.26.0
      - pytest-cov==6.0.0
      - pytest-mock==3.14.0
      - pytest-xdist==3.6.1
      - queuelib==1.7.0
      - service-identity==24.2.0
      - six==1.17.0
      - tomli==2.2.1
      - twisted==24.11.0
      - typing-extensions==4.13.0
      - w3lib==2.3.1
      - zope-interface==7.2
prefix: /opt/conda/envs/scrapy

tests/test_http_request.py::FormRequestTest::test_html_base_form_action
tests/test_http_request.py::FormRequestTest::test_from_response_button_notype tests/test_http_request.py::FormRequestTest::test_from_response_button_novalue tests/test_http_request.py::FormRequestTest::test_from_response_button_submit tests/test_http_request.py::FormRequestTest::test_from_response_checkbox tests/test_http_request.py::FormRequestTest::test_from_response_descendants tests/test_http_request.py::FormRequestTest::test_from_response_dont_click tests/test_http_request.py::FormRequestTest::test_from_response_dont_submit_image_as_input tests/test_http_request.py::FormRequestTest::test_from_response_dont_submit_reset_as_input tests/test_http_request.py::FormRequestTest::test_from_response_formid_exists tests/test_http_request.py::FormRequestTest::test_from_response_formid_notexist tests/test_http_request.py::FormRequestTest::test_from_response_formname_exists tests/test_http_request.py::FormRequestTest::test_from_response_formname_notexist tests/test_http_request.py::FormRequestTest::test_from_response_formname_notexists_fallback_formid tests/test_http_request.py::FormRequestTest::test_from_response_get tests/test_http_request.py::FormRequestTest::test_from_response_input_hidden tests/test_http_request.py::FormRequestTest::test_from_response_input_text tests/test_http_request.py::FormRequestTest::test_from_response_input_textarea tests/test_http_request.py::FormRequestTest::test_from_response_invalid_html5 tests/test_http_request.py::FormRequestTest::test_from_response_multiple_clickdata tests/test_http_request.py::FormRequestTest::test_from_response_multiple_forms_clickdata tests/test_http_request.py::FormRequestTest::test_from_response_noformname tests/test_http_request.py::FormRequestTest::test_from_response_nr_index_clickdata tests/test_http_request.py::FormRequestTest::test_from_response_override_clickable tests/test_http_request.py::FormRequestTest::test_from_response_override_params tests/test_http_request.py::FormRequestTest::test_from_response_post tests/test_http_request.py::FormRequestTest::test_from_response_radio tests/test_http_request.py::FormRequestTest::test_from_response_select tests/test_http_request.py::FormRequestTest::test_from_response_submit_first_clickable tests/test_http_request.py::FormRequestTest::test_from_response_submit_not_first_clickable tests/test_http_request.py::FormRequestTest::test_from_response_submit_novalue tests/test_http_request.py::FormRequestTest::test_from_response_unicode_clickdata tests/test_http_request.py::FormRequestTest::test_from_response_xpath
tests/test_http_request.py::RequestTest::test_ajax_url tests/test_http_request.py::RequestTest::test_body tests/test_http_request.py::RequestTest::test_copy tests/test_http_request.py::RequestTest::test_copy_inherited_classes tests/test_http_request.py::RequestTest::test_eq tests/test_http_request.py::RequestTest::test_headers tests/test_http_request.py::RequestTest::test_immutable_attributes tests/test_http_request.py::RequestTest::test_init tests/test_http_request.py::RequestTest::test_method_always_str tests/test_http_request.py::RequestTest::test_replace tests/test_http_request.py::RequestTest::test_url tests/test_http_request.py::RequestTest::test_url_no_scheme tests/test_http_request.py::RequestTest::test_url_quoting tests/test_http_request.py::FormRequestTest::test_ajax_url tests/test_http_request.py::FormRequestTest::test_body tests/test_http_request.py::FormRequestTest::test_copy tests/test_http_request.py::FormRequestTest::test_copy_inherited_classes tests/test_http_request.py::FormRequestTest::test_custom_encoding tests/test_http_request.py::FormRequestTest::test_empty_formdata tests/test_http_request.py::FormRequestTest::test_eq tests/test_http_request.py::FormRequestTest::test_from_response_ambiguous_clickdata tests/test_http_request.py::FormRequestTest::test_from_response_errors_formnumber tests/test_http_request.py::FormRequestTest::test_from_response_errors_noform tests/test_http_request.py::FormRequestTest::test_from_response_extra_headers tests/test_http_request.py::FormRequestTest::test_from_response_formid_errors_formnumber tests/test_http_request.py::FormRequestTest::test_from_response_formname_errors_formnumber tests/test_http_request.py::FormRequestTest::test_from_response_invalid_nr_index_clickdata tests/test_http_request.py::FormRequestTest::test_from_response_non_matching_clickdata tests/test_http_request.py::FormRequestTest::test_from_response_override_method tests/test_http_request.py::FormRequestTest::test_from_response_override_url tests/test_http_request.py::FormRequestTest::test_headers tests/test_http_request.py::FormRequestTest::test_immutable_attributes tests/test_http_request.py::FormRequestTest::test_init tests/test_http_request.py::FormRequestTest::test_method_always_str tests/test_http_request.py::FormRequestTest::test_multi_key_values tests/test_http_request.py::FormRequestTest::test_replace tests/test_http_request.py::FormRequestTest::test_url tests/test_http_request.py::FormRequestTest::test_url_no_scheme tests/test_http_request.py::FormRequestTest::test_url_quoting tests/test_http_request.py::XmlRpcRequestTest::test_ajax_url tests/test_http_request.py::XmlRpcRequestTest::test_body tests/test_http_request.py::XmlRpcRequestTest::test_copy tests/test_http_request.py::XmlRpcRequestTest::test_copy_inherited_classes tests/test_http_request.py::XmlRpcRequestTest::test_eq tests/test_http_request.py::XmlRpcRequestTest::test_headers tests/test_http_request.py::XmlRpcRequestTest::test_immutable_attributes tests/test_http_request.py::XmlRpcRequestTest::test_init tests/test_http_request.py::XmlRpcRequestTest::test_method_always_str tests/test_http_request.py::XmlRpcRequestTest::test_replace tests/test_http_request.py::XmlRpcRequestTest::test_url tests/test_http_request.py::XmlRpcRequestTest::test_url_no_scheme tests/test_http_request.py::XmlRpcRequestTest::test_url_quoting tests/test_http_request.py::XmlRpcRequestTest::test_xmlrpc_dumps
scrapy/http/request/form.py
scrapy/http/request/form.py