diff --git a/mechanicalsoup/form.py b/mechanicalsoup/form.py
index 7819535..285fac6 100644
--- a/mechanicalsoup/form.py
+++ b/mechanicalsoup/form.py
@@ -307,7 +307,8 @@ class Form(object):
         found = False
         inps = self.form.select('input[type="submit"], button[type="submit"]')
         for inp in inps:
-            if inp == submit or inp['name'] == submit:
+            if inp == submit or (inp.has_attr('name') and
+                                 inp['name'] == submit):
                 if found:
                     raise LinkNotFoundError(
                         "Multiple submit elements match: {0}".format(submit)

Crash on input without name in form
I am currently dealing with a form containing a submit button without a name. When submitting this form (with multiple submit buttons) via
```
browser.submit_selected(btnName='name')
```
this causes a crash in `Form.choose_submit()` since the attribute `name` is not present, [here](https://github.com/MechanicalSoup/MechanicalSoup/blob/master/mechanicalsoup/form.py#L310).

I now that inputs without a name do not make any sense, but it would be nice to harden MechanicalSoup against websites out there in the wild... :)
diff --git a/tests/test_form.py b/tests/test_form.py
index 4f89422..a97a5b4 100644
--- a/tests/test_form.py
+++ b/tests/test_form.py
@@ -350,5 +350,21 @@ def test_form_print_summary(capsys):
     assert err == ""
 
 
+def test_issue180():
+    """Test that a KeyError is not raised when Form.choose_submit is called
+    on a form where a submit element is missing its name-attribute."""
+    browser = mechanicalsoup.StatefulBrowser()
+    html = '''
+<form>
+  <input type="submit" value="Invalid" />
+  <input type="submit" name="valid" value="Valid" />
+</form>
+'''
+    browser.open_fake_page(html)
+    form = browser.select_form()
+    with pytest.raises(mechanicalsoup.utils.LinkNotFoundError):
+        form.choose_submit('not_found')
+
+
 if __name__ == '__main__':
     pytest.main(sys.argv)

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-flake8 pytest-mock requests_mock
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
beautifulsoup4==4.12.3
certifi==2021.5.30
charset-normalizer==2.0.12
coverage==6.2
flake8==5.0.4
idna==3.10
importlib-metadata==4.2.0
iniconfig==1.1.1
lxml==5.3.1
mccabe==0.7.0
-e git+https://github.com/MechanicalSoup/MechanicalSoup.git@736083562d4cc03efdf08f7be16ced8fb1460ee5#egg=MechanicalSoup
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-flake8==1.1.1
pytest-mock==3.6.1
requests==2.27.1
requests-mock==1.12.1
six==1.17.0
soupsieve==2.3.2.post1
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0

name: MechanicalSoup
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
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - 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=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - beautifulsoup4==4.12.3
      - charset-normalizer==2.0.12
      - coverage==6.2
      - flake8==5.0.4
      - idna==3.10
      - importlib-metadata==4.2.0
      - iniconfig==1.1.1
      - lxml==5.3.1
      - mccabe==0.7.0
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - pytest-flake8==1.1.1
      - pytest-mock==3.6.1
      - requests==2.27.1
      - requests-mock==1.12.1
      - six==1.17.0
      - soupsieve==2.3.2.post1
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - zipp==3.6.0
prefix: /opt/conda/envs/MechanicalSoup

tests/test_form.py::test_issue180
tests/test_form.py::flake-8::FLAKE8
tests/test_form.py::test_submit_online tests/test_form.py::test_submit_set tests/test_form.py::test_choose_submit[preview] tests/test_form.py::test_choose_submit[save] tests/test_form.py::test_choose_submit[cancel] tests/test_form.py::test_choose_submit_fail[not tests/test_form.py::test_choose_submit_fail[found] tests/test_form.py::test_choose_submit_multiple_match tests/test_form.py::test_form_noaction tests/test_form.py::test_form_action tests/test_form.py::test_set_select[default] tests/test_form.py::test_set_select[selected] tests/test_form.py::test_set_select_multiple[select tests/test_form.py::test_form_not_found tests/test_form.py::test_form_check_uncheck tests/test_form.py::test_form_print_summary
mechanicalsoup/form.py
mechanicalsoup/form.py